Afficher un message
Vieux 22/02/2008, 08h31   #9
Old Wolf
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: vector.erase(iterator iter) will change "iter" or not?

On Feb 22, 4:31 am, Richard Herring <junk@[127.0.0.1]> wrote:
> In message <fpk2sg$5d...@news.datemas.de>, Victor Bazarov
> >The iterator that refers to the removed element and all elements
> >after the removed one are invalidated by that operation. IOW, the
> >Standard makes no attempt to define what the 'iter' would point to
> >after being erased.

>
> I wonder if the OP is confused because the iterator is passed by value
> and therefore not modified? Obviously erase(iter) can't change its
> _value_, but it certainly changes its _meaning_ - what it points to is
> no longer valid.


The value certainly is changed: previously it was
well-defined and now it is indeterminate! It doesn't
point anywhere; it's nonsensical to say that what
it points to is not valid. Perhaps you mean to say
that the representation isn't changed;
  Réponse avec citation
 
Page generated in 0,04559 seconds with 9 queries