What is a Map and how would I use one in C++?
What is a Map? How would I create and use one in C++? ...
What is a Map? How would I create and use one in C++? ...
I have some simple SVG artwork (icon and glyph kind of things) which I want to display in an OpenGL app (developing in C++ on Debian, using Qt). The obvious solution is to use the ImageMagick libs to convert the SVGs to raster images and texture map them onto some suitable polygons (or just use good old glDrawPixels). However, I'm wond...
In the ArduinoUnit unit testing library I have provided a mechanism for giving a TestSuite a name. A user of the library can write the following: TestSuite suite("my test suite"); // ... suite.run(); // Suite name is used here This is the expected usage - the name of the TestSuite is a string literal. However to prevent hard-to-find b...
One of our old C++ projects is still with Visual Studio 6. Once a year I try to convert it in to a higher Visual Studio Version but it's not easy because not all the code is written by us. Anyway, I finally succeeded in converting the project to VS2005 after fixing a few hundred lines of code. But compiling the projects takes a very lon...
Hello, I have a class that is currently in a .lib file: class __declspec(dllexport) ReportData { public: list<FileData *> ReportFileData; list<SupressionData *> ReportSupressionData; static char *ClientName; static char *DataRecieved; std::string GenFileConfTemplate(); ~ReportData() ...
Commence V 2.0 of this question. My VC++ MFC application compiles and runs just fine. That is, until I switch to another window. As soon as my program loses focus, it freezes; I cannot switch back to it and if I move a window that is in front of it, my app window displays white in the space that the other window was covering. Since I f...
I know how to perform this for C++/CLI and .NET in general but, C++ doesn't have Attributes. The scenario is this: We want to provide some methods in the binary but we don't want all of our customers to use them. If a customer needs it, we can either tell him what the signature is or, send him another non-binary file. ...
I want to perform the action at a certain timeout, like fire an event. I figured out how to do every n number of seconds, but not 1.5 seconds. Here is what I have. Please suggest how to handle my case: void Publish() { static int local_time=time(NULL); int current_time = time (NULL); if((current_time+PUBLISH_TIMEOUT)>loc...
char *ps; ps = &anotherChar; cout << ps; Why this displays the value of anotherChar not just the address?. ...
Which of these 2 methods is better and why? Method 1: void fun(int i) { //do stuff } ... for_each(a.begin(), a.end(), fun); Method 2: class functor { public: void operator()(int i); }; ... for_each(a.begin(), a.end(), functor()); Edit: Should have formulated it this way, in what situation is one of the above method preferabl...
I have three different base classes: class BaseA { public: virtual int foo() = 0; }; class BaseB { public: virtual int foo() { return 42; } }; class BaseC { public: int foo() { return 42; } }; I then derive from the base like this (substitute X for A, B or C): class Child : public BaseX { public: int foo() { return ...
I've got a medium scale project (a turn-based game) that's currently written in C/C++. Only one person is working on it. It will complie with /clr, although I haven't tried /clr:pure. I'm looking for advice on the overall process of converting it to C#. It's mainly C with a thin veneer of C++ on it (C with static/singleton classes for ...
Hi What's the best, complex math library in c++? (I'd like to use it in graphics engine) EDIT: I should precise it a bit: it should have all 3d math, like planes, spheres, points, AABB, etc. and of course matrix, vector, quaternion support. ...
We have a message processing system where low latency is critical. Recently, I found that while we keep a high rate through our system we are seeing some "outliers." (Messages that take much longer then they should) When we removed logging our systems show none of these outliers. Right now our logging is basically just a wrapped os...
I bring up a GetOpenFileName dialog, enter a URL to a SharePoint sever, and it lets me browse that server using the Web Client Service (WebDAV mini-redirector). I am trying to get the initial directory to come up as that URL, but it seems to ignore it (using OPENFILENAME struct's lpstrInitialDir. Local paths work fine. EDIT: Paul re...
Hello everyone, I'm busy with programming a class that creates an index out of a text-file ASCII/BINARY. My problem is that I don't really know how to start. I already had some tries but none really worked well for me. I do NOT need to find the address of the file via the MFT. Just loading the file and finding stuff much faster by searc...
This question in mainly pointed at C/C++, but I guess other languages are relevant as well. I can't understand why is switch/case still being used instead of if/else if. It seems to me much like using goto's, and results in the same sort of messy code, while the same results could be acheived with if/else if's in a much more organized m...
I'm reviewing a collegue's code, and I see he has several constants defined in the global scope as: const string& SomeConstant = "This is some constant text"; Personally, this smells bad to me because the reference is referring to what I'm assuming is an "anonymous" object constructed from the given char array. Syntactically, it's le...
I want to return two values, one of which is a new object. I can do this using std::pair: class A { //... }; std::pair<A*, int> getA() { A* a = new A; //... } To make the code exception-safe, I would like to do: std::pair<std::auto_ptr<A>, int> getA() { std::auto_ptr<A> a(new A); //... } But this won't compile as th...
I'm copying over text from one file to another, with certain changes. I have input.txt, tmp.txt and output.txt. The idea is to copy a few lines over to tmp.txt (until we reach a delimiter), move the text from tmp.txt to output.txt, wipe tmp.txt and then continue the cycle until we reach the end of input.txt. I'm having trouble with ...