I've read that accessing elements by position index can be done in constant time in a STL deque. As far as I know, elements in a deque may be stored in several non-contiguous locations, eliminating safe access through pointer arithmetic. For example:
abc->defghi->jkl->mnop
The elements of the deque above consists of a single character....
I have a C++ MFC app that stores all of its system wide configuration settings to the registry. Previously, we used .INI files, and changed over to using the registry some years back using
SetRegistryKey("MyCompanyName");
We now get regular support calls from users having difficulty migrating from PC and Windows version to another, ...
Hi,
I'm using some vsprops sheets that inherit from each other. My base property sheet defines some include paths. In a second vsprops file that inherits from it, I want to add some more include paths.
However, I want to be able to choose whether the additional include paths come before or after the base include paths. I'm sure I've se...
I have question about removing element from QList.
"myclass.h":
class node2D : public QObject
{
Q_OBJECT
public:
node2D(){++s_NCount;};
~node2D(){--s_NCount;};
int checkCount(){return s_NCount;};
private:
static int s_NCount;
};
"myclass.cpp":
int node2D::s_NCount = 0;
"main.cpp":
void main()
{
int i,ma...
I'm reading some c++ code and Notice that there are "#include" both in the header files and .cpp files . I guess if I move all the "#include" in the file, let's say foo.cpp, too its' header file foo.hh and let foo.cpp only include foo.hh the code should work anyway taking no account of issues like drawbacks , efficiency and etc .
I kno...
Hi,
I have a question to clarify my confusion about the memory organization in computer in C++.
In C++, different data is put in different location. My understanding is like this.
1) data segment section, where global and static data are located;
2) heap section, the objects created by new
3) stack section, the...
In C# I would fire up the Stopwatch class to do some quick-and-dirty timing of how long certain methods take.
What is the equivalent of this in C++? Is there a high precision timer built in?
...
I've got a largeish codebase that's been around for a while and I'm trying to tidy it up a bit by refactoring it. One thing I'd like to do is find all the headers where I could forward declare members, instead of including the entire header file.
This is a fairly labour intensive process and I'm looking for a tool that could help me fi...
Well I've the following problem.
Facts;
- Using eclipse
- Using MinGW
I wanted to benchmark my created C++ program. I searched google and then came;
http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html
I then wanted to add the "-pg" build command. But how/where do I add it? I went in to the "properties - C/C++ build - Discovery Optio...
According to this question about the topic there is no asynchronous file io in asio anything but Windows...
So fine, does anyone know of any already written extensions to asio that do asynchronous file io on Linux?
Or does anyone know of any examples on how to extend asio to support asynchronous io to {insert-whatever-here}?
...
The program is supposed to receive an input through cin, tokenize it, and then output each one to show me that it worked properly. It did not.
The program compiles with no errors, and takes an input, but fails to output anything.
What am I doing wrong?
int main(int argc, char* argv[])
{
string input_line;
while(std::cin >> input_...
Using Qt stylesheets, is it possible to set a different background colour for each tab in a QTabBar that has 4 or more tabs?
My Qt application has 6 tabs underneath the menu bar. I'd like to change their background colours to 6 different colours using stylesheets.
2 issues appear to be standing in my way:
I can only style the "first"...
Is there a way to have custom animation replace the defauly windows animation when you drag a window to the edge of the screen?
...
How is state kept when accessing methods through JNI? In the example below my Java code is calling the native method drawFromJni, will my native class _nc be persisted between calls?
If there were better native debugging tools for the NDK this would be pretty easy to find out, but I'm really having problems with the NDK and C++.
exter...
In c++, when and how to use a callback function?
EDIT:
I would like to see a simple example to write a callback function.
...
In my game engine I have a State class that represents the game world at a point in time. This State contains a number of Body objects that define one rigid body each. Each State has a container to keep track of the Body objects it owns, and each Body has a pointer back to its parent State.
Outline of State class:
class State {
private...
In my manager.exe, I'm trying to change the CPU usage of my worker.exe, which is started by my service.exe. Service.exe is running under the System Account, while manager.exe is running under the logged in user's account.
When I call OpenProcess in manager.exe with worker.exe's PID, I get NULL for procHandle:
HANDLE procHandle = O...
Hello,
I have the following code :
#define LIMIT_DATE \"01-03-2010\"
#ifdef LIMIT_DATE
#if _MSC_VER
#pragma message ("Warning : this release will expire on " LIMIT_DATE)
#elif __GNUC__
#warning ("Warning : this release will expire on " LIMIT_DATE)
#endif
#endif
The problem is that LIMIT_DATE is not eval...
I need a good C++ tutorial aimed at sameone who once programmed in C++ (although not extensively) but didn't use it much in last couple of years.
It should be:
Short and clear
Have short introduction to basic concepts
Have an overview of new developments in C++ and best practices
Note that I don't need a programming concepts introdu...
Online references have rather brief and vague descriptions on the purpose of std::iostream::sentry. When should I concern myself with this little critter? If it's only intended to be used internally, why make it public?
...