Compare two consecutive elements in std::list
I'd like to compare two consecutive elements in a std::list while iterating through the list. What is the proper way to access element i+1 while my iterator is at element i? Thanks Cobe ...
I'd like to compare two consecutive elements in a std::list while iterating through the list. What is the proper way to access element i+1 while my iterator is at element i? Thanks Cobe ...
I'm using WinSNMP in c++ to send snmp traps. For backwards compatibility I’m required to send v1 snmp traps. WinSNMP works with v2 traps but is capable of converting those v2 traps to v1 when sending the trap. I use SnmpSetTranslateMode(SNMPAPI_UNTRANSLATED_V1) in order to do that. I also added the sysUpTime oid (1.3.6.1.2.1.1.3.0), the ...
If I declare a temporary auto deleted character buffer using std::auto_ptr<char> buffer(new char[n]); then the buffer is automatically deleted when the buffer goes out of scope. I would assume that the buffer is deleted using delete. However the buffer was created using new[], and so strictly speaking the buffer should be deleted usi...
OK, so I couldn't really think of an apropos title that summarizes this. The IPrintPipelinePropertyBag interface has the method AddProperty which aptly enough "adds a property to a property bag." http://msdn.microsoft.com/en-us/library/aa506384.aspx AddProperty( [in, string] const wchar_t *pszName, [in] const VARIANT *pVa...
I apologize in advance for the long post... I used to be able to build our VC++ solutions (we're on VS 2008) when we listed the STLPort include and library directories under VS Menu > Tools > Options > VC++ Directories > Directories for Include and Library files. However, we wanted to transition to a build process that totally relies o...
Most of the documentation available for building Python extension modules uses distutils, but I would like to achieve this by using the appropriate python autoconf & automake macros instead. I'd like to know if there is an open source project out there that does exactly this. Most of the ones I've found end up relying on a setup.py file...
Here's the situation: I have one VS2005 solution with two projects: MyDll (DLL), MyDllUnitTest (console EXE). In MyDll I have a class called MyClass which is internal to the DLL and should not be exported. I want to test it in MyDllUnitTest, so I added a test suite class called MyClassTest, where I create instances of MyClass and test ...
Hi My goal is to integrate testing into my development environment (as post-build step). I don't want to interfere with the DLLs that are generated in debug and release, so i plan to create new configurations for the project. But i don't want to compile every source file i have twice - once for the DLL, once for the test unit - I want t...
Hi all, I was wondering how to make a toolbar in MFC that used 24bit or 256 colour bitmaps rather than the horrible 16 colour ones. Can anyone point me in the direction of some simple code? Thanks ...
I'm kind of new to C++ and have some questions, this is one of them. Is there ANY reason when you are using a function that takes in one or several parameters, parameters of which you know will always be stored in a variable before the function call, to pass a copy of the variable, rather than a pointer to the variable? I'm talking in...
I'm currently writing a C# application that does a lot of digital signal processing, which involves a lot of small fine-tuned memory xfer operations. I wrote these routines using unsafe pointers and they seem to perform much better than I first thought. However, I want the app to be as fast as possible. Would I get any performance benef...
I need to get the File version information from an exe file originally written in C++ from a C# program. Using Assembly.LoadFile(fullpath).GetName().Version results in a BadImageFormatException. Can anyone help? Cheers, Dan ...
I'm developing an application which has a lot of text and also different modules which can be included or not in every build. For each saved project we generate automatically a report with all the details (i.e. description of algorithms used in that project and so on). Currently we embed all text as strings in the source code and we als...
I have three closely related applications that are build from the same source code - let's say APP_A, APP_B, and APP_C. APP_C is a superset of APP_B which in turn is a superset of APP_A. So far I've been using a preprocessor define to specify the application being built, which has worked like this. // File: app_defines.h #define APP_A ...
I'm interested in putting together my first online game using Flash as the client and writing a back-end application in C++ where the actual game state is kept. I've done lots of games in C++ before using SDL, SFML, Allegro, etc etc but never gotten around to using the network libraries. I was just interested in some helpful direction f...
I just noticed that you can not use standard math operators on an enum such as ++ or += So what is the best way to iterate through all of the values in a C++ enum? ...
What would be the best way to check that a std::vector is sorted ? Is there something faster than a loop checking that v[i]<=v[i+1] ? Is it faster/cleaner with iterators ? Or is it actually better to just call sort every time (though the "v is already sorted" case is quite common) ? We can safely assume the vector only contains PODs, us...
Just wondering where is best to put functionality in an MFC application that is triggered when the whole window is resized. I was thinking mainfrm but I couldn't seem to capture any OnSize messages... Can someone tell me what I am doing wrong? ...
How can I write a C++ function returning true if a real number is exactly representable with a double? bool isRepresentable( const char* realNumber ) { bool answer = false; // what goes here? return answer; } Simple tests: assert( true==isRepresentable( "0.5" ) ); assert( false==isRepresentable( "0.1" ) ); ...
GNU gcc 4.3 partially supports the upcoming c++0x standard: among the implemented features the rvalue reference. By means of the rvalue reference it should be possible to move a non-copyable object or return it from a function. Are std::streams already movable by means of rvalue reference or does the current library implementation lack...