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

2322. Associative(initializer_list, stuff) constructors are underspecified

Section: 24.2.7 [associative.reqmts], 24.2.8 [unord.req] Status: C++14 Submitter: Stephan T. Lavavej Opened: 2013-09-21 Last modified: 2017-07-05

Priority: 0

View other active issues in [associative.reqmts].

View all other issues in [associative.reqmts].

View all issues with C++14 status.

Discussion:

24.2.7 [associative.reqmts] specifies both X(i,j) and X(i,j,c), but only X(il). 24.4.4.1 [map.overview] declares "map(initializer_list<value_type>, const Compare& = Compare(), const Allocator& = Allocator());" but 24.4.4.2 [map.cons] intentionally doesn't explain it, relying on the big table's requirements. As a result, map(il, c)'s behavior is not actually specified by the Standard. (All of the other ordered associative containers also provide such constructors.)

The unordered associative containers are similarly affected, although they have more arguments. (Again, the actual containers are correctly depicted with the desired constructors, their behavior just isn't specified.)

[Issaquah 2014-02-11: Move to Immediate]

Proposed resolution:

This wording is relative to N3691.

  1. Edit 24.2.7 [associative.reqmts], Table 102 — "Associative container requirements", as indicated:

    Table 102 — Associative container requirements (in addition to container) (continued)
    Expression Return type Assertion/note pre-/post-condition Complexity
    X(il); Same as X(il.begin(), il.end()). sSame as X(il.begin(), il.end()).
    X(il, c);   Same as X(il.begin(), il.end(), c). Same as X(il.begin(), il.end(), c).
  2. Edit 24.2.8 [unord.req], Table 103 "Unordered associative container requirements", as indicated:

    Table 103 — Unordered associative container requirements (in addition to container)
    Expression Return type Assertion/note pre-/post-condition Complexity
    X(il) X Same as X(il.begin(), il.end()). Same as X(il.begin(), il.end()).
    X(il, n) X Same as X(il.begin(), il.end(), n). Same as X(il.begin(), il.end(), n).
    X(il, n, hf) X Same as X(il.begin(), il.end(), n, hf). Same as X(il.begin(), il.end(), n, hf).
    X(il, n, hf, eq) X Same as X(il.begin(), il.end(), n, hf, eq). Same as X(il.begin(), il.end(), n, hf, eq).