how to find collision rate of stl hash_map?
I want to know how stl hash_map is implemented. How do I find out what the table size is and the memory space the map consumes? This is in C++. ...
I want to know how stl hash_map is implemented. How do I find out what the table size is and the memory space the map consumes? This is in C++. ...
Ok.. here is some background on the issue. I have some 'critical' code that i'm trying to protect with a mutex. It goes something like this Mutex.Lock() // critical code // some file IO Mutex.Unlock(). Now the issue is that my program seems to be 'stuck' due to this. Let me explain with an example. Thread_1 comes in; and go to Mutex...
I have been doing a little recreational holiday computing. My mini-project was a simulation of the Italian game of "tomboli". A key building block was a simulation of the following process; The game is controlled by a man with a bag of 90 marbles, numbered 1 to 90. He draws marbles one by one randomly from the bag, each time calling out...
I can do this in c++/g++: struct vec3 { union { struct { float x, y, z; }; float xyz[3]; }; }; Then, vec3 v; assert(&v.xyz[0] == &v.x); assert(&v.xyz[1] == &v.y); assert(&v.xyz[2] == &v.z); will work. How does one do this in c with gcc? I have typedef struct { union { st...
What represents Math.IEEERemainder(x,y) in C++? ...
I have a virtual function that is called handlePathChange() in my Controller class. It checks the current URL and should dispatch the right view for it. Here's the code I have so far: void Controller::handlePathChange() { if ( app->internalPathMatches(basePath) ) { string path = app->internalPathNextPart(basePath); ...
I'm trying to write a glue function between two data types and I can't seem to get the compiler to be happy. On one side, I have a pointer to a chunk of data that is logically a n x 2 array, but is declared as: double* pData=new double[2*n]; On the other side, I have a c function that is declared as void Function(double data[][2], i...
Hi I try to call the VirtualQueryEx function to get some Information about Memory Protection, however my code gives me error 0x18 (ERROR_BAD_LENGTH) and i dont know whats wrong with my code; code snippet: PMEMORY_BASIC_INFORMATION alte; VirtualQueryEx(processhandle,(LPVOID) (address),alte,sizeof(PMEMORY_BASIC_INFORMATION)); thanks fo...
I'm working to improve the long languishing Linux build process for Bitfighter, and am having problems with make. My process is actually quite simple, and since make is (nearly) universal, I want to stick with it if I can. Below I've attached my current Makefile, which works, but clumsily so. I'm looking for ways to improve it, and ha...
Sorry i'm a beginner,from what i know there are number of varieties of libraries and framework out there provided for the C++ language.My question is,when we create an application using the framework and libraries,do the users of the application need to install the framework or so so call the libraries on his/her PC??Thank You ...
Is there a color picker dialog for Qt like the following? Also it needs to have a OnColorChanged signal which is called when ever the selected color changes. I want to give a live preview when they are changing the colors, that is why. Using google I could only find this one that was a triangle in side of a circle and personally I th...
Using http://www.cppreference.com/wiki/stl/deque/insert as a reference, I was inserting values into a deque at certain locations. For example, if deque A was: a, b, d, e, g with an iterator pointing to d, i can: A.insert(iter, c); // insert val c before loc iter //deque is now a, b, c, d, e, g and the iter still points to d....
I'm trying to modify this code in an attempt to make it work on an Arduino Mega. I'm pretty much new to C so, I may have made some major mistakes. By the way, this is for a self balancing skateboard. :P This code is taken from an ATmega32 (from : [url=http://sites.google.com/site/onewheeledselfbalancing/Home/twin-wheel-self-balancing-sk...
For example: ifstream input; input.open("file.txt"); translateStream(input, cout); input.close(); How to write function translateStream? void translateStream(XXXX input, YYYY output)? What are the types for input and output? Thanks ...
When I create a project in vs2005. I can also create Win32->Win32Project. I can choose "console application" or "dll" or "static library" if I created a static library project. How can I convert it to dll project. I found in setting panel of the created project. General->Configuration Type, I can switch Static Library(.lib) to DLL Howe...
Many of us have been indoctrinated in using XML for storing data. It's benefits and drawbacks are generally known, and I surely don't want to discuss them here. However in the project I'm writing in C++, I'm also using Lua. I've been very surprised how well Lua can be used to store and handle data. Yet, this aspect of Lua is less recogni...
I would like to test my C++ programming skill level by competing with others. What programming contests are there for C++? ...
I got some huge files I need to parse, and people have been recommending mmap because this should avoid having to allocate the entire file in-memory. But looking at 'top' it does look like I'm opening the entire file into the memory, so I think I must be doing something wrong. 'top shows >2.1 gig' This is a code snippet that shows what...
I am developing in Visual C++ 2008 using MSMQ. In Windows Vista, the application cannot locate the mqrt.dll which is found at C:\Windows\winsxs>cd x86_microsoft-windows-msmq-runtime-core_31bf3856ad364e35_6. 0.6002.18005_none_574cf1cdb624ee17\mqrt.dll. The description of the manifest in WinSxS is: <assembly xmlns="urn:schemas-microsoft-...
I read this article in http://www.codeproject.com/KB/shell/overlayicon.aspx. I have some questions that I cannot answer. Please help me? When I build the project to COM dll. When I use other program to call this dll. Which method could I will call to display overlay icon on the selected file? I think I will call GetOverlayInfo() first...