STL vectors and push_back
I can't seem to put anything in my vector. Let me get into specifics :
I defined class Mesh somewhere else in my code.
I wish for a Model class to contain Meshes. This is the relevent part of my code.
Code:
Model::Model(int n) {
numOfObjects = n;
objects = vector<Mesh*>(n);
}
void Model::addObject(Mesh *newObject) {
objects.push_back(newObject);
}
Strangely, my objects vector seems not to fill up. In the debugger, when I call upon push_back(), I can see that the _M_start of objects changes (to 0x113e8a0 for example) but that it still references to NULL (0x0) and I can see that my object has not been added to the vector. And then come the Bus Errors.
I can also see in the debugger that my newObject argument is a well-formed object, exactly the one I want.
What's my problem ? Without any help, it'll soon be schizophrenia. ;)