invalidate the iterators

Discussion in 'C++' started by heng, Jan 28, 2007.

  1. heng

    heng Guest

    A lot of operations such as erase and popfront will invalidate
    iterators of vector, however, what will happen to list? Is there any
    influence to list?
    Thanks a lot.
     
    heng, Jan 28, 2007
    #1
    1. Advertising

  2. heng

    Kai-Uwe Bux Guest

    heng wrote:

    > A lot of operations such as erase and popfront will invalidate
    > iterators of vector, however, what will happen to list? Is there any
    > influence to list?


    Insertions into a list do not invalidate any iterators. Erasing elements
    from a list invalidates those and only those iterators pointing to that
    element. [See 23.2.2.3]


    Best

    Kai-Uwe Bux
     
    Kai-Uwe Bux, Jan 28, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bartek
    Replies:
    3
    Views:
    681
    Victor Bazarov
    Mar 7, 2004
  2. Marcin Kaliciñski

    Iterators and reverse iterators

    Marcin Kaliciñski, May 8, 2005, in forum: C++
    Replies:
    1
    Views:
    499
    Kai-Uwe Bux
    May 8, 2005
  3. Jim Langston
    Replies:
    10
    Views:
    768
    bjeremy
    Jan 8, 2007
  4. Alan Woodland
    Replies:
    2
    Views:
    802
    James Kanze
    Mar 24, 2009
  5. Öö Tiib
    Replies:
    0
    Views:
    753
    Öö Tiib
    Jun 16, 2010
Loading...

Share This Page