Hi there!
I'm trying to start learning C++ and I have a problem.
I'm trying to create a function template,
template<multimap<string, double> arr>
void calculate(string key) {
}
and use it like this:
multimap<string, double> arr;
vector<string> keys;
// ...
for_each(keys.begin(), keys.end(), calculate<arr>);
But i doesnt'complile:
...
[SOLVED]: Applying proper list iteration procedure fixed problem. (Shown below)
I currently have a program in which elements of a list are iterated through and erased if they meet certain conditions. Due to the nature of the program, this can be visually seen.
Objects on screen that are being iterated through sometimes flicker on and o...
Hello,
Im trying to shift my array left as efficiently as possible. Im using pointers now, and im having trouble assigning the values back into my array:
void stack::rotate(int nRotations)
{
if ( count <= 1 ) return;
int *intFrontPtr = &items[top+1].n;
int *intBackPtr = &items[count-1].n;
int temp = 0;
for (int shift...
I'm programming a little game, and I set the lpfnWndProc to DefWindowProc
and after that, I made a loop in that way:
MSG lastMessage;
while (true)
{
if (PeekMessage(
&lastMessage,
this->getWindow(),
0, 0,
PM_REMOVE))
{
TranslateMessage(&lastMessage);
DispatchMessage(&lastMessage);
}
}
So how do I hand...
Hello,
I'm trying to make the BASS 2.4.4 library for my Linux Ubuntu Hardy Heron, but when I run make I'm getting many errors, see:
[ubuntu@eeepc:~/Desktop/bass24-linux] make
make -C 3dtest
make[1]: Entering directory `/home/ubuntu/Desktop/bass24-linux/3dtest'
cc -Os -I/home/ubuntu/Desktop/bass24-linux -L/home/ubuntu/Desktop/bass24-lin...
I tried out the demo application which was pretty impressive. However building it and integrating it with my own code is hard because it's such a large project.
Has anyone successfully used it for their own projects? Was is difficult to build and integrate with your own C++ code?
Link: STLab.
For the interested: there's also a Google...
Im using VS2008 and My MFC application has started to crash when setting breakpoints or running to cursor. I get lots of errors like this:-
First-chance exception at 0x78a5727c (mfc90ud.dll) in MyApp.exe: 0xC0000005: Access violation reading location 0xfffffffc.
First-chance exception at 0x00000000 in MyApp.exe: 0xC0000005: Access viol...
Can you give an example of stack overflow in C++? Other than the recursive case:
void foo() { foo(); }
...
I'm using GCC 4.3.3 on Ubuntu 9.04 64-bit and was getting errors using C++-style comments in C code. When I say "by default" in the title, I mean simply invoking gcc test.c
According to the GCC 4.3.3 docs (here), this is supported...yet I got the errors anyway.
These errors went away with a simple -std=c99 addition to my compile string...
I been programming in c++ for over 10 years now, it is my favorite programming language. I'm just a bit concerned that it's popularity is fading away, atleast in windows application development, because of c# and the .net framework. I'm not against c# or .net, I've actually program in those, and I'll admit, some things in c# and .net a...
I have a console program and I want if the user press ctrl-z the program exits and if he press ctrl-c nothing happens. In Bash i'd put a trap, what I should use in C++?
...
Hello,
I am working on an application that builds a vector of structs for items in a given directory and returns a reference of the vector for it to be read, I receive the following errors when attempting to compile the example code below:
1. 'class std::vector<indexStruct, std::allocator<indexStruct> >' has no member named 'name'
2. n...
Dear Overflowers,
I want to be able to make the compiler shout when i call a constructor of foo with a class
that is NOT derived from base. The current code allows only for foo<base> itself. Any
easy solution ?
class _base
{
public:
// ...
};
class _derived: public _base
{
public:
// ...
};
template <typename T>
class foo
{
...
Can you tell me what are the __DEFAULT__, implicit compiler options for cl.exe and for link.exe when compiling from the command line, like:
cl whatever.c
Thanks!
update: To clarify: I am not interesed in the available command line options, I have even linked them from the question. What I am asking for is a list of implicit, default ...
How can I write a function that accepts a variable number of arguments? Is this possible? How?
...
I am learning C++ in school now. Currently using C++ with codeblocks on my windows vista laptop. I noticed whenever I try to use functions from imported classes from the Clibrary I get an error in the console.
" 'hi' is not recgonized as internal or external command, operable command or batch file "
My code looks like this ...
#includ...
I'm with a fairly large team and we are running into problem with the other libraries we depend on, and getting the same project files to work for every one.
The problem is that many people have more than one version of the same library (eg the project users boost 1.36, and I use boost 1.39 for some of my other stuff), and every develop...
I am writing a program in C, but I would like to use dynamic libraries like a vector. Is it possible to use C++ libraries in a C program?
...
Suppose I want to have an inheritance hierarchy like this.
class Base
class DerivedOne : public Base
class DerivedTwo : public Base
The base class is not meant to be instantiated, and thus has some pure virtual functions that the derived classes must define, making it an abstract base class.
However, there are some functions that y...
hi,
i need a program to capture pictures from multiple webcams, and save it automatically in vista. i got the basic code from this link. http://www.cs.ru.nl/lab/des/marsrover/communication/pc%5Fimageprocessing%5Fcoordinates/VFWCapture.cpp
the code runs in windows XP but when i tried using it on vista and it says failed. different errors...