Hello, I am using a C++0x lambda expression to modify values of a map.
However, having difficulty passing the map iterator by reference.
If I just pass the iterator, by value such as: [](std::pair<TCHAR, int > iter) it compiles fine, but the values does not get updated in the map.
If I try to pass the iterator by reference, such as []...
I'm seeking of an API that can be used to dump most data structures,is there one in c/c++?
...
I am looking for an C++ IDE for Linux (other than Vim or Emacs :) ) that would automatically import a makefile (even better - automakefile), be able to compile the sources and on top of it run boost unit tests.
I have tried QT Creator, but it doesn't seem to import makefiles, and KDevelop which imports makefiles fine, but I couldn't fig...
Hi
How do I read a FIFO/named pipe line by line from a C++/Qt Linux app?
Today I can open and read from a fifo from a Qt program,
but I can't get the program to read the data line by line.
Qt reads the entire file, meaning he waits until the "sender" closes his session.
Let's take a example with some shell commands to show what I w...
I know in c++ variables have block scope, for example, the following code works in C++
void foo(){
int a = 0;
for(int i = 0; i < 10; ++i){
int a = 1; //re-define a here.
}
}
but this snippet doesnt work in java, it reports "duplicate local variable a", does it mean java variables dont have BLOCK scope?
...
What is the meaning of generic programming in c++?
Also, I am trying to figure out what container, iterator, and different types of them mean.
...
Generally everything I come across 'on-the-net' with relation to SSE/MMX comes out as maths stuff for vectors and matracies. However, I'm looking for libraries of SSE optimized 'standard functions', like those provided by Agner Fog, or some of the SSE based string scanning algorithms in GCC.
As a quick general rundown: these would be th...
I had found a strange output when I write the following lines in very simple way:
Code:
printf("LOL??!\n");
printf("LOL!!?\n");
Output:
It happens even the code is compiled under both MBCS and UNICODE.
The output varies on the sequence of "?" and "!"...
Any idea?
...
Hi,
I am developing a plugin system for an application. The idea is to load some functions from plugins (loaded as DLLs) and use those functions in our scripting language hosted in app. I have to expose an API for the DLLs for them to interact with the app. The API may change overtime and the older DLLs should not be invalidated. Plea...
In C++. I can declare most things as const, for example:
Variables: const int i=5;
Scala has val i=5, however this will only prevent reassigning, not changing the object as the following exampe shows:
C++: const int i[]={1,2,3,4};
i[2]=5; //error
Scala: val a=Array(1,2,3,4)
a(2)=5 //a is now Array(1, 2, 5, 4)
It gets even worse with mem...
Here's what I'm getting now by wprintf:
1胩?鳧?1敬爄汯?瑳瑡獵猆慴畴??
Is utf8 just not supported by windows?
...
Hi, I am creating a Qt4 c++ application and i target Windows and Linux. For windows i added an entry in the registry to create a context menu in explorer. After adding this feature the windows users want me to add an icon in that context menu. It seams that the only way to add the icon is to use a shell extension(except for windows 7 whe...
I have written some code in C++ with a corresponding C interface (i.e C-function wrappers around the classes) that a friend wants to use in an iPhone application.
Since I heard you can compile C++ for the plattform, but not use the iPhone sdk at the same time (sic) I thought that compiling all the code into a static library that my frie...
I am a "C" programmer that knows just the tiniest bits of C++. I am having a look at some open source C++ code trying to understand some things that it is doing. I can work out most of it but sometimes there is syntax I don't recognise and I'd like to be able to "look up" the meaning of the syntax so I can read just enough to understand ...
The answer from TcKs gave me an idea, thus i tried following:
system("mailto:[email protected]?subject=Test");
and
STARTUPINFO info = {sizeof(info)};
PROCESS_INFORMATION processInfo = {0};
if (!::CreateProcess(NULL, "mailto:[email protected]",
NULL, NULL, FALSE, 0, NULL, NULL, &info, &process...
I have a piece of C++ code that deallocates memory as follows
for (int i = Pages-1; i >= NewPages; i--)
{
LPVOID p = m_Pages[i];
free(p);
}
While the code works ok, when called from an exception handler, it runs very slowly. Looking at task manager while single stepping through the above loop, the amount of physical memory us...
Suppose I have a std::vector say Vector
Now after performing some operations on the vector(either insertion or deletion) I want to check if the vector is empty and on the basis of that I want to perform some operations.
Which approach is better
Approach 1
if (Vector.size() == 0){ /* operations */ }
Approach 2
if (Vector.empty()) {...
My team is currently using CppUnit for all our unmanaged C++ unit tests but I'm toying with the idea of transitioning to NUnit through either GenTestAsm (pure C#) or C++/CLI. Either way, what consequences would I face on the Code Coverage front with either of these approaches?
We currently use PureCoverage to instrument our unmanaged...
I have to work out a small framwork that is going to be used by several of our applications. On top of this, the framework is going to be used multiple times within the same application, but with a slightly different configuration. The 'nature' of the configuration is more complex than just having some configuration options and some se...
The below code explains the problem. Fill in same_sub_class to detect if
the two pointers to virtual base class A are in fact the same concrete
class.
struct A {
...
}:
struct B : public A {
...
}:
struct C : public A {
...
}
bool same_sub_class(A * a1, A * a2){
// Fill this in to return true if a1 and a2 are
//...