Quickie: Can std::deque::push_back() invalidate its iterators?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bartek

    Quickie: Can std::deque::push_back() invalidate its iterators?

    Hi,

    I'm sorry for asking such a simple question.
    I just would like to know what's the standard-defined behaviour when doing
    a push_back() on a std::deque.

    TIA,
    b
  • Victor Bazarov

    #2
    Re: Quickie: Can std::deque::pus h_back() invalidate its iterators?

    "bartek" <bartekd@qwerty uiop.o2.pl> wrote...[color=blue]
    > I'm sorry for asking such a simple question.
    > I just would like to know what's the standard-defined behaviour when doing
    > a push_back() on a std::deque.[/color]

    The answer is, yes, it does invalidate _all_ iterators. However,
    unlike insertion into the middle of a deque, insertion into either
    end does not invalidate the references to elements in the deque
    (the Standard, 23.2.1.3).

    Victor


    Comment

    Working...