Mike Smith wrote:
>
If you have x declared as a vector<Class>, then x[i] is a Class, while
x.end() is a vector<Class>::iterator, which will cast to (Class *).
Not quite: there is no required conversion from an iterator to a
pointer. To get the address of the object that the iterator points to
you'd use &*iter (assuming that the object's type does not overload the
unary & operator). The reason you can use iter->whatever is that
iterators provide an operator->.
--
-- Pete
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." For more information about this book, see
www.petebecker.com/tr1book.