Title
Sequence container back function should also support const_iterator
Status
c++11
Section
[sequence.reqmts]
Submitter
Alisdair Meredith

Created on 2009-03-12.00:00:00 last changed 154 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

In [sequence.reqmts] Table 84, replace iterator with auto in semantics for back:

Table 84 — Optional sequence container operations
Expression Return type Operational semantics Container
a.back() reference; const_reference for constant a { iterator auto tmp = a.end();
--tmp;
return *tmp; }
vector, list, deque, basic_string
Date: 2010-10-21.18:28:33

[ Batavia (2009-05): ]

We agree with the proposed resolution. Move to Tentatively Ready.

Date: 2010-10-21.18:28:33

[ Summit: ]

Agree.

Date: 2012-10-21.13:19:07

Addresses UK 234 [CD1]

The reference to iterator in semantics for back should also allow for const_iterator when called on a const-qualified container. This would be ugly to specify in the 03 standard, but is quite easy with the addition of auto in this new standard.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg435
2010-10-21 18:28:33adminsetmessages: + msg434
2010-10-21 18:28:33adminsetmessages: + msg433
2009-03-12 00:00:00admincreate