 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
bartek Guest
|
Posted: Sun Mar 07, 2004 3:43 pm Post subject: Quickie: Can std::deque::push_back() invalidate its iterator |
|
|
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
|
|
| Back to top |
|
 |
Victor Bazarov Guest
|
Posted: Sun Mar 07, 2004 4:03 pm Post subject: Re: Quickie: Can std::deque::push_back() invalidate its iter |
|
|
"bartek" <bartekd (AT) qwertyuiop (DOT) o2.pl> wrote...
| Quote: | 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.
|
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
|
|
| Back to top |
|
 |
Andre Kostur Guest
|
Posted: Sun Mar 07, 2004 5:45 pm Post subject: Re: Quickie: Can std::deque::push_back() invalidate its iter |
|
|
"Victor Bazarov" <v.Abazarov (AT) comAcast (DOT) net> wrote in
news:3JH2c.516928$na.1173596@attbi_s04:
| Quote: | "bartek" <bartekd (AT) qwertyuiop (DOT) o2.pl> wrote...
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.
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, did you just contradict yourself? The OP asked about a push_back
(ie: insertion to the end of the deque), then you answered that it does
invalidate all iterators, but not if you insert into either end.
|
|
| Back to top |
|
 |
Victor Bazarov Guest
|
Posted: Sun Mar 07, 2004 10:17 pm Post subject: Re: Quickie: Can std::deque::push_back() invalidate its iter |
|
|
"Andre Kostur" <nntpspam (AT) kostur (DOT) net> wrote...
| Quote: | "Victor Bazarov" <v.Abazarov (AT) comAcast (DOT) net> wrote in
news:3JH2c.516928$na.1173596@attbi_s04:
"bartek" <bartekd (AT) qwertyuiop (DOT) o2.pl> wrote...
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.
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, did you just contradict yourself? The OP asked about a push_back
(ie: insertion to the end of the deque), then you answered that it does
invalidate all iterators, but not if you insert into either end.
|
Please reread my answer. Iterators and references are NOT the same thing.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|