Pointer to vector element -
03-03-2004
I cannot figure out how to get a pointer to an element through an iterator,
indexing works but since I'm using an iterator that is out.
The vector holds structures by value and the class that it is contained in has a method to get an iterator to an item by looking up it's name.
The return of the Find method is something like this: std::vector< mystruct* >::iterator.
Since Find is a private method I have also added a public Lookup method to return a pointer to the element in the array.
I don't use Vector or the STL that often so I'm not quite sure how to do this.
Any ideas?
|