c++

C++ static initialization

what should be the behavior in the following case: class C { boost::mutex mutex_; std::map<...> data_; }; C& get() { static C c; return c; } int main() { get(); // is compiler free to optimize out the call? .... } is compiler allowed to optimize out the call to get()? the idea was to touch static variable t...

Creating RightClick Menu for Explorer

If some one can provide some sample articles on how to create Right Click Menu for Drives. Here is what needed: The right click menu will contain two additional things, i.e: Connect and Disconnect. Can we make it conditional? I mean for some condition The drive will make the Connect enabled(Ideally when not connected) and when connected...

is it possible to design a better collections library than stl for c++?

the title says it all... now answer! ...

Query regarding overflow function of streambuf

hi Going thorugh overflow function documentation. I found overflow has following as return values. Return Value: A value different than EOF (or traits::eof() for other traits) signals success. If the function fails, either EOF (or traits::eof() for other traits) is returned or an exception is thrown. source :"http://www.cplusplus.com...

Why should the implementation and the declaration of a template class be in the same header file?

Why should the implementation and the declaration of a template class be in the same header file? Could any of you explain it by example? ...

Templates :Name resolution -->can any one tell an other example for this statement...please

This is the statement from ISO C++ Standard 14.6/8: When looking for the declaration of a name used in a template definition, the usual lookup rules are used for nondependent names. The lookup of names dependent on the template parameters is postponed until the actual template argument is known (14.6.2). Example: #include <iost...

An effecient datastructure to hold structure variable with sorting capability

Hi ppl, I have a structure struct dbdetails { int id; string val; }; I need a data structure in C++ that can hold structure variable with a sort capability. Is it possible? im a newbie. Sorry If this questions is wrong. I was looking at vector, which can hold structure variable, but I will not be able to sort it based on id ...

Qt Drag&Drop with own widgets?

I created a little widget on my own, including a QProgressBar and a QLabel in a QVBoxLayout. It has also a function which returns the text of the label (self-created). Now in my MainWindow I have two other QHBoxLayouts and I want to drag and drop my widget from one to another. It also works when I click on the little free space between t...

How to suppress boost::thread warnings with gcc ?

Hi, In my project, I recently decided to use boost::thread. My code compiles fine under Linux, but under Windows (either x86 or x64), I get the following warnings with gcc 4.5: In file included from C:\Boost\include\boost-1_44/boost/thread/shared_mutex.hpp:14:0, from C:\Boost\include\boost-1_44/boost/thread/detail/thre...

Unable to link afx_msg in BEGIN_MESSAGE_MAP

Hi, I'm trying to hook into the OnSysCommand function but I'm getting a confusing error. In the header, I am declaring the function like: afx_msg void OnSysCommand(UINT nID, LPARAM lParam ); And in the cpp the code is: BEGIN_MESSAGE_MAP(CMFCTest1App, CWinAppEx) ON_COMMAND(ID_APP_ABOUT, &CMFCTest1App::OnAppAbout) // Standard file b...

C++ video handling

What is the easiest method for reading in the raw data (raw RGB image data for each frame) from a video file, in C++. I really would appreciate some good detailed responses, or helpful links. I intend to manipulate the data using inline assembly. I am using microsoft visual C++ 2010 express. ...

How to resize array in C++?

Possible Duplicate: Can you resize a C++ array after initialization? I need to do the equivalent of the following C# code in C++ Array.Resize(ref A, A.Length - 1); How to achieve this in C++? ...

How to query the thread count of a process using the regular Windows C/C++ APIs

Hi all. Is there a way to query the number of threads that are currently running for a specific process using the standard Windows C/C++ APIs? I already prowled through the MSDN docs but the only thing that comes near is BOOL WINAPI GetProcessHandleCount( __in HANDLE hProcess, __inout PDWORD pdwHandleCount ); which queries ...

virtual disk in mac os x

Hey all, I am trying to create a virtual disk driver which will create an exact replica of an existing disk partition using IOkit framework in mac os x leopard. Can anyone tell me how it can be done and if possible which api`s to use? P.S: the coding is in c++. Ironhide. ...

How to subclass JavaScriptCore's JSC::Debugger c++ class?

I wanted to subclass the JSC::Debugger from JavaScriptCore. I always end up with the same error: Undefined symbols: "typeinfo for JSC::Debugger", referenced from: typeinfo for JavaScriptDebuggerin JavaScriptDebugger.o ld: symbol(s) not found collect2: ld returned 1 exit status I don't know enough about c++ to understand why th...

C++ Failure on MSVCR80.dll using Microsoft.SqlServer.Management

Hi all, I am trying to run test on my server but it fails due to some C++ error coming from MSVCR80.dll. On my machine it runs smoothly but on the server, I do not find a way to make it work. Here is the error I have when running my tests (sorry it is in italian but it could be easily understood, I guess, everybody speaks italian, no?)...

parsing robots.txt file using c++

Hello, is there is any library to check robots.txt or else how can i right it in c++ with boost regex please explain with some examples.... ...

Accumlation error revisit

Hello, I got another question which continues from this one http://stackoverflow.com/questions/3695178/accumulation-error I heard some good idea and tried to implement it to the program. That is that I could store the results in Integer type first and afterward convert it to a float type. But the problem is that I can produce the corr...

How to define an iterator in a template?

Hello, I'm trying to define an iterator to iterate my map to erase it (destructor) I'm getting an error : incompatible iterator. My destructor looks like this : Consortium<S,T>::~Consortium() { map<const S, Node<T>*>::iterator deleteIterator; for (m_consortiumMap.begin() ; deleteIterator != m_consortiumMap.end() ; del...

Programmatically extracting .deb packages

Hi to everyone, i've got a question and i hope someone will help me :) I have .deb package which contents i need to extract. I need to do it programmatically. The problem is that i cannot find any valuable resources on the net which can help me. I really don't have any Linux (Unix) experience so maybe i'm searching for it in the wrong w...