C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Quickie: Can std::deque::push_back() invalidate its iterator

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
bartek
Guest





PostPosted: Sun Mar 07, 2004 3:43 pm    Post subject: Quickie: Can std::deque::push_back() invalidate its iterator Reply with quote



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





PostPosted: Sun Mar 07, 2004 4:03 pm    Post subject: Re: Quickie: Can std::deque::push_back() invalidate its iter Reply with quote



"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





PostPosted: Sun Mar 07, 2004 5:45 pm    Post subject: Re: Quickie: Can std::deque::push_back() invalidate its iter Reply with quote



"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





PostPosted: Sun Mar 07, 2004 10:17 pm    Post subject: Re: Quickie: Can std::deque::push_back() invalidate its iter Reply with quote

"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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.