3028. Container requirements tables should distinguish const and non-const variables

Section: 26.2.1 [container.requirements.general] Status: New Submitter: Jonathan Wakely Opened: 2017-10-17 Last modified: 2017-11-24

Priority: 3

View other active issues in [container.requirements.general].

View all other issues in [container.requirements.general].

View all issues with New status.

Discussion:

[container.requirements.general] p4 says:

In Tables 83, 84, and 85 X denotes a container class containing objects of type T, a and b denote values of type X, u denotes an identifier, r denotes a non-const value of type X, and rv denotes a non-const rvalue of type X.

This doesn't say anything about whether a and b are allowed to be const, or must be non-const. In fact Table 83 uses them inconsistently, e.g. the rows for "a = rv" and "a.swap(b)" most certainly require them to be non-const, but all other uses are valid for either const or non-const X.

[2017-11 Albuquerque Wednesday night issues processing]

Priority set to 3; Jonathan to provide updated wording.

Wording needs adjustment - could use "possibly const values of type X"

Will distinguish between lvalue/rvalue

Proposed resolution:

This wording is relative to N4687.

  1. Change 26.2.1 [container.requirements.general] p4 as indicated:

    -4- In Tables 83, 84, and 85 X denotes a container class containing objects of type T, a and b denote values of type X, u denotes an identifier, r and s denotes a non-const values of type X, and rv denotes a non-const rvalue of type X.

  2. Change 26.2.1 [container.requirements.general], Table 83 "Container requirements", as indicated:

    Table 83 — Container requirements
    Expression Return type Operational
    semantics
    Assertion/note
    pre/post-condition
    Complexity
    […]
    ar = rv X& All existing elements
    of ar are either move
    assigned to or
    destroyed
    ar shall be equal to
    the value that rv had
    before this
    assignment
    linear
    […]
    ar.swap(bs) void exchanges the
    contents of ar and bs
    (Note A)
    […]
    swap(ar, bs) void ar.swap(bs) (Note A)