Hi,
I have this:
//function definition
//Point and Range are classes made of 2 ints
Point barycenter_of_vector_in_range(vector<cv::Point> &points, cv::Range range);
//In other place...
vector<vector<Point> > tracks_; //it has some content
for (vector< vector<Point> >::const_iterator track = tracks_.begin(); track != tracks_.end(); tr...
take a look at following simple code :
class A;
class B
{
A a;
};
class A
{
B b;
};
int main(int argc, char *argv[])
{
return 1;
}
it does not compile, why ?
Error Message from GCC (Qt):
main.cpp:6: error: field ‘a’ has incomplete type
...
Can anyone tell me a code for next function, which raises EXCEPTION_FLT_STACK_CHECK or EXCEPTION_BREAKPOINT, for I could catch them in main func:
int _tmain(int argc, _TCHAR* argv[])
{
__try
{
FaultingStack(); // What I need to write in this function???
}
__except(GetExceptionCode() == EXCEPTION_FLT_STACK_CHEC...
Hello,
I have abstract class:
#include <string>
using namespace std;
class AString
{
public:
virtual ~AString() {}
virtual const string& GetName() const = 0;
virtual const string& GetValue() const = 0;
virtual const int GetSize() const = 0;
};
And derivative class. I try to overload binary + in ...
I'm writing a "PersonalVec" template class - a vector with other qualities.
As a template class, i've implemented everything in the .hpp, as follows:
#ifndef PERSONALVEC_HPP_
#define PERSONALVEC_HPP_
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <cassert>
usi...
I have one QGraphicsScene as the main scene with several movable QGraphicsItems in it and another QGraphicsScene on top of the main scene as an overlay. The overlay scene is exactly the same size as the user's display,whereas the main scene is much bigger, so it needs to be scrolled up and down automatically.
Well, if an item in the mai...
I'm using codeblocks. I'm using ubuntu. Here is output of compilation.
g++ -Wall -O2 -m32 -nostdlib -Iinclude -c /home/miroslav/Development/WEBGINE/src/WEBGINE/Component.cpp -o obj/ReleaseCGI32/src/WEBGINE/Component.o
g++ -Wall -O2 -m32 -nostdlib -Iinclude -c /home/miroslav/Development/WEBGINE/src/WEBGINE/Debug/ComData.cpp -...
How to connect to remote udp multicast if I have an IP address where the service resided (say 70.70.70.70), the multicast group to connect (say 224.25.25.25) and port (say 2020)?
I use ACE framework and in the sniffer I see that ACE sends IGMP packet to 224.0.0.2, in order to join a group, but my home router (checkpoint) doesn't know wh...
Lets say we have this code:
class test_t
{
void* data;
public:
template <typename T>
T operator [](int index)
{
return reinterpret_cast<T*>(data)[index];
}
};
int main()
{
test_t test;
int t = test.operator []<int>(5);
return 0;
}
Is there a way to convert it to compilable idiomatic C++?
It sh...
Hi,
I have a very large code, a lot of which is legacy code.
I want to know which of all these files are taking part in the compilation.
The code is written in GNU compilers and mostly in C/C++, but some in other programs too.
Any advice will be highly appreciated.
Thanks,
Moshe.
I am compiling under linux with a mix of scripts/...
I just start learning metaprogramming, I wonder the implementation of swap.
Can anyone help me and explain the idea of traits in metaprogramming? thanks.
...
Maybe my Google-fu just isn't strong enough.
Using GCC 4.4.3, I've got a set of classes like this:
template <typename storage_t, typename index_t = std::size_t, typename
leaf_payload_t = std::size_t>
struct btree_node {
public:
typedef btree_node<storage_t, index_t, leaf_payload_t> this_t;
typedef boost::shared_ptr<this...
class B{
private:
int a;
}
class D: public B{
private:
int b;
}
B* b = new B;
Now for some reason I want turn b into a D* Type of Object.
e.g. retain the information of B and become D with extra Informations required.
What I am currently thinking of is. static_cast to do the upcasting. the additional attributes will be se...
Dear all,
I'm not sure if the snippet of C++ code below is legitimate or not:
std::vector<int*> myints;
for (int i = 0; i<N; i++) {
int j = i;
myints.push_back(&j);
}
for (int i=0; i<myints.size(); i++) cout<<*(myints[i])<<endl;
How does the compiler handle this ? I understand the variable j itself goes out of scope when ex...
I have a program that contains the following piece of code for constructing an array of asterisks:
char array[Length][Height];
for (int count1 = 1; count1 <= Length; count1++)
{
for (int count2 = 1; count2 <= Height; count2++)
{
strcpy(array[count2][count3], "*");
cout << array[count2][count3];
}
}
cout << e...
I am writing an C++ application that could be compiled under Linux (gcc 4.3) and Windows (MS VS08 Express).
My application uses third-party libraries,
On Linux , they are compiled as shared libraries, while
on Windows, there are two versions "Debug" and "Release".
I know that debug version provides extra support for debugging ( just...
Hi, i know little about pipes but have used one to connect two processes in my code in visual C++. The pipe is working well, but I need to add error handling to the same, hence wanted to know what will happen to a pipe if the server creating it crashed and how do I recognize it from client process?
Also what will happen if the client pr...
Hi,
since some days I'm working with the VTK and I need some help. Is it possible to swap out the rendering codeblock?Like this:
void display(XXXXXX)
{
vtkActor actor = new vtkActor();
actor.SetMapper(XXXXXXX);
vtkRenderer ren2 = new vtkRenderer();
ren2.AddActor(actor);
vtkRenderWindow ren...
I want to get sound level, so I can display it in my SDL application (the platform is Linux) when recording sound. How can I do that? I use FMOD API in my app, but for recording, I'm using SoX (forking and using exec() to set it up - probably this could be done better but I don't know how :( ). Should I use some function of SoX, FMOD API...
I want serialize object to binary file using operator "<<", but
when I serialize, for example, int fields, I obtained it's symbolic representation:
ofstream out("file", ios::out | ios::binary);
int i=0xAA;
out << i;
And output:
0x31 0x37 0x30
i.e. (0xAA -> 170)
170
If I use write function, all ok:
out.write((char*)&i,sizeof(int...