Issue 140: map<Key, T>::value_type does not satisfy the assignable requirement (original) (raw)


This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD Editorial status.

140. map<Key, T>::value_type does not satisfy the assignable requirement

Section: 23.4.3 [map] Status: NAD Editorial Submitter: Mark Mitchell Opened: 1999-04-14 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [map].

View all issues with [NAD Editorial](lwg-status.html#NAD Editorial) status.

Discussion:

23.2 [container.requirements]

expression return type pre/post-condition
------------- ----------- -------------------
X::value_type T T is assignable

23.4.3 [map]

A map satisfies all the requirements of a container.

For a map<Key, T> ... the value_type is pair<const Key, T>.

There's a contradiction here. In particular, `pair<const Key, T>' is not assignable; the `const Key' cannot be assigned to. So, map<Key, T>::value_type does not satisfy the assignable requirement imposed by a container.

[See issue 103(i) for the slightly related issue of modification of set keys.]

Rationale:

The LWG believes that the standard is inconsistent, but that this is a design problem rather than a strict defect. May wish to reconsider for the next standard.