I have a class like this:
class OBJ{...};
class A
{
public:
vector<OBJ> v;
A(int SZ){v.clear(); v.reserve(SZ);}
};
A *a = new A(123);
OBJ something;
a->v.push_back(something);
This is a simplified version of my code. The problem is in debug mode it works perfect. But in release mode it crashes at "push_back" line. (with all optimization flags OFF) I debugged it in release mode and the pr开发者_Python百科oblem is in the constructor of A. the size of the vector is something really big with dummy values and when I clear it, it doesn't change...
Do you know why?
Thanks,
I can guess - I would say that OBJ probably does not have a correctly implemented copy constructor and/or assignment operator and destructor.
精彩评论