"Victor Bazarov" <> wrote in message
news:BDIrd.11643$. verio.net...
> Mike Wahler wrote:
> > "Lieven" <> wrote in message
> > news:41af51e4$0$13470$...
> >
> >>Consider:
> >>
> >>std::vector<int> vec(100);
> >>
> >>vector<int>::iterator it(vec.begin());
> >>
> >>for(int i(0); i < 10000000; i++){
> >> vec.push_back(rand());
> >>}
> >>
> >>It is possible that vec get's reallocated.
> >
> >
> > Yes, possible, and probable. Also note that your
> > code above results in a vector containing
> > 10000100 elements, the first hundred of which
> > have a value of zero.
> >
> >
> >>My question is: to what will it
> >>point?
> >
> >
> > A vector does not 'point'. A vector is not a pointer.
> > It's a container which stores objects.
>
> 'it' here is a variable, the iterator, initialised with 'vec.begin()'.
Ah, right, I see that now. I thought he was using the English word
'it' (referring to the vector).
-Mike
|