L
laniik
Hi. I have a question. If I have a vector of objects and on of object
pointers:
---
vector <Obj> objects;
vector <Obj*> objectPointers;
---
and i setup the vectors with somhthing like:
---
Obj o;
objects.push_back(o);
objectPointers.push_back(&objects[objects.size()-1])
---
now. when i grow the objects array:
---
for(int i=0;i<10000;i++)
{
Obj o;
objects.push_back(o);
}
---
is it possible that the pointer in the objectPointer array become
invalid when STL shifts the objects vector around in memory?
thanks!
Oliver
pointers:
---
vector <Obj> objects;
vector <Obj*> objectPointers;
---
and i setup the vectors with somhthing like:
---
Obj o;
objects.push_back(o);
objectPointers.push_back(&objects[objects.size()-1])
---
now. when i grow the objects array:
---
for(int i=0;i<10000;i++)
{
Obj o;
objects.push_back(o);
}
---
is it possible that the pointer in the objectPointer array become
invalid when STL shifts the objects vector around in memory?
thanks!
Oliver