Title
Incorrect specification of return value for map<>::at()
Status
c++11
Section
[map.access]
Submitter
Matt Austern

Created on 2010-11-01.00:00:00 last changed 162 months ago

Messages

Date: 2010-11-02.12:34:56

Proposed resolution:

Change the wording in [map.access]/9 so it's identical to what we already say for operator[], which is unambiguous and correct.

Returns: A reference to the element whose key is equivalentmapped_type corresponding to x in *this.

Date: 2010-11-02.20:29:53

In [map.access]/9, the Returns clause for map<Key, T>::at(x) says that it returns "a reference to the element whose key is equivalent to x." That can't be right. The signature for at() says that its return type is T, but the elements of map<Key, T> have type pair<const K, T>. (I checked [unord.map.elem] and found that its specification of at() is correct. This is a problem for map only.)

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2011-04-11 11:23:23adminsetstatus: voting -> wp
2011-03-05 15:24:28adminsetstatus: ready -> voting
2010-11-13 23:03:59adminsetstatus: new -> ready
2010-11-02 12:34:56adminsetmessages: + msg5261
2010-11-01 00:00:00admincreate