Add custom messages in assert?
Hello, exists a way to add or edit the message thronw by assert. I'd like to use something like assert(a==b,"A must be equal to B"); Then, the compiler adds line, time and so on.... It is posible? ...
Hello, exists a way to add or edit the message thronw by assert. I'd like to use something like assert(a==b,"A must be equal to B"); Then, the compiler adds line, time and so on.... It is posible? ...
Given a set of functions, such as: template<class A1> Void Go(A1 a); template<class A1, class A2> Void Go(A1 a1, A2 a2); template<class A1, class A2, class A3> Void Go(A1 a1, A2 a2, A3 a3); Is it possible to take an array of some variant type and given its contents, fire the correct function? My application for this is that I want ...
i'm trying to write to append data to the end of a file, and am using the seekp(streamoff off, ios_base::seekdir dir) function but it doesn't append, somehow it writes the data in the middle of the file. i tried adding opening the file like this - file.open(resultFile,fstream::in|fstream::out); (as was suggested in other similar posts) t...
I just noticed that eclipse has a extensive intellisense for stl. If you hover over any stl function or object you get information similar to what you would find in a c++ stl reference. This is however not the case in VS2010 and I'm wondering if there is any good plugin that might enable this? and even more far fetched... for boost as w...
With NetBeans (v. 6.9.1) I cannot get syntax highlighting for the Boost library, i.e. all stuff present in Boost is not recognised. However the project is built correctly. I already set the paths in: NetBeans > Preferences > C/C++ > Code Assistance > C++ Compiler. Here I added the /usr/local/include path. The Boost headers are in /usr/...
Couldn't find anything about this topic. I have a Windows TCP C++ server application which I want to update from time to time. As you obviously understand this introduces a problem - the server should be 24/7 from the users' perspective. When updating, it is also desired to keep the current TCP connections with the users. I've been ...
Say I have a listview control with several items in it. How would I allow the user to drag and drop items to rearrange them in the control. The listview control is in report view, with the full-row select extended style. Thanks in advance. ...
In C# I know you can use the default keyword to assign default values as 0 to value types and null to reference types and for struct types individual members are assigned accordingly. To my knowledge there are no default values in C++. What approach would you take to get the same functionality as the default keyword for Generics while pr...
I am working on a personal learning project to make a Minecraft clone. It is working very well aside from one thing. Similar to Minecraft, my terrain has lots of cubes stacked on the Y so you can dig down. Although I do frustum culling, this still means that I uselessly draw all the layers of cubes below me. The cubes are X, Y and Z orde...
I am curious as to how I would go about reading the input from a text file with no set structure (Such as notes or a small report) word by word. The text for example might be structured like this: "06/05/1992 Today is a good day; The worm has turned and the battle was won." I was thinking maybe getting the line using getline, and then ...
Is there a way to do a quick and dirty 3D distance check where the results are rough, but it is very very fast? I need to do depth sorting and im using stl sort like this: bool sortfunc(CBox* a, CBox* b) { return a->Get3dDistance(Player.center,a->center) < b->Get3dDistance(Player.center,b->center); } flo...
I am setting the font for a control like this: HDC hdc = GetDC(NULL); int lfHeight = -MulDiv(szFont, GetDeviceCaps(hdc, LOGPIXELSY), 72); ReleaseDC(NULL, hdc); HFONT font = CreateFont(lfHeight, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Font.c_str()); SendMessage(hwnd,WM_SETFONT,(WPARAM)font,0); The control is a static. How would I find the ...
I have a chess variants engine that plays suicide chess and losers chess along with normal chess. I might, over time, add more variants to my engine. The engine is implemented completely in C++ with proper usage of OOP. My question is related to design of such a variant engine. Initially the project started as a suicide-only engine whi...
template<typename OutputIterator> void BlitSurface::ExtractFrames(OutputIterator it, int frame_width, int frame_height, int frames_per_row, int frames_per_column, bool padding) const { SDL_Surface ** temp_surf = SDL_Ex_ExtractFrames(_surfa...
My professor sent back a short email: int x = 100; var HT*; HT = new int[x]; Firstly: Compiling the code (with other stuff around it to make it "work"): error: 'var' does not name a type. Second: This is for hash tables. Apparently this is the way to create an array of variable size according to the ANSI standard (G++ has extensions ...
I have the following class with a couple friend functions: class Teleport { public: Teleport(); ~Teleport(); void display(); Location teleportFrom(int direction); friend bool overlap(Wall * wall, Teleport * teleport); friend bool overlap(Location location); friend bool overlap(Wall * wall); friend bool o...
struct Movie { char* date; char* title; char* rating; int runtime; }; typedef Movie* moviePtr; moviePtr tempDB; bool doStuff() { //... snip .,, tempDB = new Movie[tempC]; int i; ifs >> temp; while(ifs.good() && i < tempC) { tempDB[i].date = new char[strlen(temp)+1]; strcpy(tempDB[i]....
int* HT; int HTc = 500; HT = new int[HTc] = {-1}; //Fill array with -1 I get the warning: extended initializer lists only available with -std=c++0x or =std=gnu++0x I'll assume this means it isn't compatible with the ANSI standard, which my prof. is nuts for. How else would I do this though? ...
I hope this has a technical (rather than a religious) answer, but I wonder if I should use Objective-C or C++ to create an OpenGL ES Application on the iPad? As the ultimate goal would be to compile it on Windows and OS X as well, I'm inclined to use C++ (and only use ObjC for the stuff that I have to: App Delegate etc.), but I have zer...
Slightly related to my other question, how do I execute JavaScript from an Obj-C/C++ program on OSX? (I think JavaScript will allow me to do what I need to, even though AppleScript doesn't. According to the Photoshop documentation anyway.) I need it to be able to interact with Photoshop. ...