I have a the following code.
vector* irds = myotherobj->getIRDs();//gets a pointer to the vector
for(vector::iterator it = ir
You can get a pointer from an iterator by doing &*it
. You get a pointer to the actual IRD
object stored inside the vector. You can modify the object through the pointer and the modification will "stick": it will persist inside the vector.
However, since your vector contains the actual objects (not pointers to objects) I don't see any point in dynamic_cast
. The type of the pointer is IRD *
and it points to IRD
object.
The only case when the dereferenced iterator might refer to a copy (or, more precisely, to a proxy object) is vector
, which might be implemented as a bit-vector.