When I'm debugging C++ mixed (managed/unmanaged) projects in Visual Studio 2005, I often get weird data from the debug watches, like below :
(btw, the variable i_processName is a const std::string & )
Note that the variable actually holds valid data - if i print it to stdout, the printed string is just fine, thanks for asking.
The sim...
How can I automatically replace all C style comments (/* comment */) by C++ style comments (// comment)? This has to be done automatically in several files. Any solution is ok, as long as it works.
...
for (int i = 0 ; i < stlVector.size() ; i++)
{
if (i == 10)
{
stlVector.erase(stlVector.begin() + 5 )
}
}
Does the termination condition part "stlVector.size()" take "stlVector.erase(...)"
into consideration? In other word does stlVector.size() refresh for every loop iteration?
I can't test it right now, so i post...
I'm trying to compile google cache-table using Visual Studio 2005 and remains one issue :
\mm\cache_table.hpp(734) : error C2780: 'void std::_Destroy(_Ty *)' : expects 1 arguments - 2 provided
c:\arquivos de programas\microsoft visual studio 8\vc\include\xmemory(58) : see declaration of 'std::_Destroy'
\mm\cache_table.hpp(714) : while c...
Looking for some general advice...
I've been using boost for a while, and I've written several small modules and function (eg: see this SO question) which I think cold be appropriate for inclusion in boost. I've been to the project pages to see about the submission process, but it seems like it's "be on the inside, or don't bother". I c...
Hi,
I am trying to compile the regex_search function on the vxWorks gcc platform. I was testing with an example to see if I can use it without any issues. The example file includes the following three headers.
#include <string>
#include <map>
#include <boost/regex.hpp>
The errors I get are as follows
include/c++/3.4.4/cwchar:73: er...
What is the best way to programmatically generate a GUID or UUID in C++ without relying on a platform-specific tool? I am trying to make unique identifiers for objects in a simulation, but can't rely on Microsoft's implementation as the project is cross-platform.
Notes:
Since this is for a simulator, I
don't really need cryptographic...
In the C++ Boost libraries, why is there a ".ipp" extension on some header files?
It seems like they are header files included by the ".hpp" file of the same name.
Is this convention common outside of Boost?
What is the justification for having a special file type?
...
When should someone use structs instead of classes or vice versa in C++? I find myself using structs when a full-blown class managing some information seems like overkill but want to indicate the information being contained are all related. I was wondering what are some good guidelines to be able to tell when one is more appropriate th...
I'm quite fond of using GNU getopt, when programming under Linux. I understand, that getopt(), is not available under MS VC++.
Note:
Win32 environment
using Visual Studio
No Boost
No MFC
Not concerned with portability
Question:
How can I then port getopt() accordingly?
What guidelines should I be aware of while porting?
Known po...
I recently had cause to work with some Visual Studio C++ projects with the usual Debug and Release configurations, but also 'Release All' and 'Debug All', which I had never seen before.
It turns out the author of the projects has a single ALL.cpp which #includes all other .cpp files. The *All configurations just build this one ALL.cpp f...
Hi,
We have a quite large (280 binaries) software project under Linux and currently it has a very dispersed code structure - that means one can't [work out] what code from the source tree is valid (builds to deployable binaries) and what is deprecated. But the Makefiles are good. We need to calculate C/C++ SLOC for entire project.
Here...
I'm attempting to draw text to the screen using GLUT in 2d.
I want to use glutBitmapString(), can someone show me a simple example of what you have to do to setup and properly use this method in C++ so I can draw an arbitrary string at an (X,Y) position?
glutBitmapString(void *font, const unsigned char *string);
I'm using linux, and ...
I have a std::list of Points (that simply store an x, y). Each one of these points represents a polygon, which I later draw.
class Point {
public:
int x, y;
Point(int x1, int y1)
{
x = x1;
y = y1;
}
};
std::list <Point> currentPolygon;
I would like to have a list of these polygons (lists themselves).
...
Can anyone recommend a C++ wrapper for ncurses?
...
I am a Junior Engineer with under a year experience, primarily as a UI developer. We have a former Lead Programmer who just got laid off who is interviewing at our company, and I am one of the people interviewing him. He has almost 25 years of experience, so obviously it will be pointless to ask him technical questions.
As a junior prog...
I'm trying to concat "(" + mouseX + ", " + mouseY ")". However, mouseX and mouseY are ints, so I tried using a stringstream as follows:
std::stringstream pos;
pos << "(" << mouseX << ", " << mouseY << ")";
_glutBitmapString(GLUT_BITMAP_HELVETICA_12, pos.str());
And it doesn't seem to work.
I get the following error:
mouse.cpp:7...
I am having small problem in making a global variable works. I am using Visual Studio 2008 and standard C++.
I have two projects, one is a static library and second one is a test program which uses this library. I have a global variable in global.h like
#ifndef GLOBAL_H
#define GLOBAL_H
#include <string>
extern std::string globalWo...
I have a PolygonList and a Polygon type, which are std::lists of Points or lists of lists of points.
class Point {
public:
int x, y;
Point(int x1, int y1)
{
x = x1;
y = y1;
}
};
typedef std::list<Point> Polygon;
typedef std::list<Polygon> PolygonList;
// List of all our poly...
Instead of using
std::vector<Object> ObjectArray;
I would like it to be
MyArray<Object> ObjectArray;
with all the std::vector methods preserved. (like push_back(), reserve(), ...etc)
However, using
typedef std::vector MyArray;
won't work. Should I use template instead? How?
Thanks in advance.
...