Inserting into a vector
Posted on 2000-02-21
What is the correct way to insert a new object into a vector? For example:
// Create vector
// Add a whole bunch of stuff
// Now insert something in the middle
vObjects.insert (&vObjects, new CMyClass);
That last line causes an error. It can't convert the pointer to a reference. So I try adding a & or * to it along with a mixture of parenthesis in the vain hope that something will click, but nothing. How do I get a reference out of that pointer? I know I ran into this before, it must be something extremely common, I just program too much in Java and that language hides most of this ugliness from us...