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

Section: 26.4.4 [map] Status: NAD Editorial Submitter: Mark Mitchell Opened: 1999-04-14 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [map].

View all issues with NAD Editorial status.

Discussion:

26.2 [container.requirements]

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

26.4.4 [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 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.