c++

One more string implementation in C: advantages and disadvantages

After reading the article "Back to Basics" by Mr.Spolsky I have thought about string structure in C, that converges most of advantages of Pascal-style string (with length byte) and classic ASCIIZ-strings in C and reduces most of their disadvantages. The main demand is to make this new string effective in machine commands. (for this task ...

Netbeans re produce Makefile when change options in c/c++ developing

I create new c/c++ project in Netbeans and change Makefile and add -lpthread for work with pthread and run my project .also I need to add some runtime argument from project properties/Run/Arguments . when I change runtime Arguments Makefiles that place at /'project folder'/nbproject/private/Makefile-Debug.mk & Makefile-Release.mk are re ...

#define TheVLM(x) VLM::Global()->x TheVLM(Run());

What does this mean in C++: #define TheVLM(x) VLM::Global()->x TheVLM(Run()); ...

Counting keys in a hash_multimap

What is the most efficient way to count all the different keys in a hash_multimap? E.g. if I have a already filled hash_multimap, (e.g. a container where you can store multiple entities with a same key) how can i retrieve the set of keys? ...

Supporting multiple human languages

I am thinking about my final year project and the possibility of supporting multiple languages, e.g. English, Welsh, German etc.. Is there a standard way of supporting multiple human languages in a program? What is the recommended file format for storing the different languages? It is something I am clueless on but is obviously a very ...

How can we use .NET dll in VC++?

Please suggest me the best way to use .NET dll in VC++ project. ...

Windows 7 GUI reference

I maintain a large C++ application using Win32 and i want to use some of the new controls introduced in Vista/Windows 7 (New ballon help, command links, status bar notofications. I have downloaded the Windows User Experience Interaction Guidelines, but i dont find a corresponding API Reference. I know that some of these controls will b...

What is the advantage of using initializers for a constructor in C++?

Sphere() : theRadius(1.0) { } Why is it preferable to have a constructor written with initializers (above) than a constructor that initializes the data members within its body (below)? Sphere() { theRadius = 1.0; } ...

building a factory with object repository in C++?

I want to create a factory for creation of objects implementing an abstract interface, which would return a reference to the object that is kept internally, and objects are not replicated. The idea is pretty much the same as in the log4cxx/log4j Logger class design. I would also like to hide as much details from the client as possible, i...

Set a QComboBox or QSpinBox to a value not allowed

I am maintaining an application which tries to help the user get his parameters to work together, as there are many interdependencies. Now there is a default value of x for a variable Y. When the user changes some other variable Z, there might be a new minimum value for Y which is greater than x. This is set as a minimum for the spinbo...

Pointer for item in iteration over std::list

I'm working on a very basic game and I have a std::list collection of objects that pertain to my game. I declared it as: std::list<Target> targets; When I iterate over it, using for (std::list<Target>::iterator iter = targets.begin(); iter != targets.end(); iter++) { Target t = *iter; t.move(); } My objects are...

Waf generating Visual Studio projects?

Can the Waf build system generate Visual Studio project files for C/C++? ...

Locks and Mutexes in C++

Hi everyone, I learn C++ for a while and still didn't come across good book which would explain what are those beasts? Are they integral C++ feature? If so how is it that they are only mentioned in such book like The C++ Programming Language by B.S. If not, where can you get reliable information about them - prefferably a book (don't rea...

Passing a managed reference to a method taking unmanaged pointer

Is it possible to make this work? template<class T> fun(T * t) { t->someMemberFunc(); } ... somewhere in the code: ManagedType ^ managedP = gcnew ManagedType(); UnmanagedType * unmanagedP = new UnmanagedType(); fun(managedP); ...

Setting a column style? (Unmanaged c++)

I'm currently able to set a listview style VIA the ListView_SetExtendedListViewStyle method, however this makes all columns have the same style. My goal is to only modify one column (to basically have the LVS_EX_UNDERLINEHOT|LVS_EX_UNDERLINECOLD|LVS_EX_TWOCLICKACTIVATE style). Is there a way to modify the style of only one column and no...

Problem interfacing C++ POS controls with the .NET POS SDK

We're trying implement a .NET Service Object that supports a COM interface to emulate a POSPrinter but still be compatible with the older technologies. We have our interface and class object in the following class.. using [...] namespace yRPOSPrinterDotNet { [Guid("2D570F11-4BD8-40e7-BF14-38772063AAF0")] [InterfaceType(ComIn...

Runtime error: Access violation when using .push_back() with a std::vector?

I have a vector, defined by std::vector<LPDIRECT3DTEXTURE9> textures; Later, I am passing a LPDIRECT3DTEXTURE9 object to it, like so textures.push_back(texture); Here is a sample of this: void SpriteManager::AddSprite(float x, float y, float z, LPDIRECT3DTEXTURE9 texture) { //snip textures.push_back(texture); //snip } Th...

How can I get an iterator on a vector of templated objects ?

Hi, I have a very silly problem with the code shown below. The goal is to increment multiple counters at once, and have their value printed after being processed by a provided functor. However g++ complains : test.hpp:32: error: expected `;' before 'it' " I tried to add some typedef, but the error message remains. Here is the code (...

[C++] Using a virtually inherited function non-virtually?

Hello! I have run into trouble trying to implement functionality for serializing some classes in my game. I store some data in a raw text file and I want to be able to save and load to/from it. The details of this, however, are irrelevant. The problem is that I am trying to make each object that is interesting for the save file to be ab...

How to accept empty value in boost::program_options

I'm using boost::program_options library to process command line params. I need to accept a file name via -r option, in case if it is empty (-r given without params) I need to use stdin. desc.add_options() ("replay,r", boost::program_options::value<std::string>(), "bla bla bla") In this case boost wouldn't accept -r without params an...