 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Wed Jun 28, 2006 3:40 pm Post subject: references into a deque |
|
|
Inserting or deleting an element at the front or back of a deque does
not invalidate
references and pointers to other elements in the deque.
I only see this mentioned explicitly in the standard for insert and
erase in 23.2.1.3 (at least
in the final draft from 1998).
Where is it mentioned for push_back, push_front, pop_back, pop_front?
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ] |
|
| Back to top |
|
 |
johnchx2@yahoo.com Guest
|
Posted: Thu Jun 29, 2006 9:10 am Post subject: Re: references into a deque |
|
|
pr2345 (AT) gmail (DOT) com wrote:
| Quote: | Inserting or deleting an element at the front or back of a deque does
not invalidate
references and pointers to other elements in the deque.
I only see this mentioned explicitly in the standard for insert and
erase in 23.2.1.3 (at least
in the final draft from 1998).
Where is it mentioned for push_back, push_front, pop_back, pop_front?
|
23.1.1/12 (table 6 defines the operational semantics of push_back and
push_front in terms of insert, and those of pop_back and pop_front in
terms of erase. Therefore the guarantees applicable to insert and
erase also apply to these functions.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ] |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Jun 29, 2006 9:10 am Post subject: Re: references into a deque |
|
|
pr2345 (AT) gmail (DOT) com wrote:
| Quote: | Inserting or deleting an element at the front or back of a deque does
not invalidate
references and pointers to other elements in the deque.
I only see this mentioned explicitly in the standard for insert and
erase in 23.2.1.3 (at least
in the final draft from 1998).
Where is it mentioned for push_back, push_front, pop_back, pop_front?
|
IIRC, that follows from the definition of those functions. They are
equivalent
to insert and erase at either end. Hence, they invalidate the same
elements
as the equivalent insert or erase statement would.
HTH,
Michiel Salters
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ] |
|
| Back to top |
|
 |
Bo Persson Guest
|
Posted: Thu Jun 29, 2006 4:22 pm Post subject: Re: references into a deque |
|
|
<pr2345 (AT) gmail (DOT) com> skrev i meddelandet
news:1151432353.758349.183230 (AT) p79g2000cwp (DOT) googlegroups.com...
| Quote: | Inserting or deleting an element at the front or back of a deque
does
not invalidate
references and pointers to other elements in the deque.
I only see this mentioned explicitly in the standard for insert and
erase in 23.2.1.3 (at least
in the final draft from 1998).
Where is it mentioned for push_back, push_front, pop_back,
pop_front?
|
In the 2003 edition of the standard, table 68 (23.1.1) defines these
funtions in terms of insert and delete, like
a.pop_front() a.erase(a.begin())
etc.
That must mean that the same guarantees hold.
Bo Persson
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ] |
|
| Back to top |
|
 |
Carl Barron Guest
|
Posted: Thu Jun 29, 2006 4:32 pm Post subject: Re: references into a deque |
|
|
In article <1151432353.758349.183230 (AT) p79g2000cwp (DOT) googlegroups.com>,
<pr2345 (AT) gmail (DOT) com> wrote:
| Quote: | Inserting or deleting an element at the front or back of a deque does
not invalidate
references and pointers to other elements in the deque.
I only see this mentioned explicitly in the standard for insert and
erase in 23.2.1.3 (at least
in the final draft from 1998).
Where is it mentioned for push_back, push_front, pop_back, pop_front?
table 68 on page 464 in the approved standard and in the 2006 draft. |
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ] |
|
| 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
|
|