Title
Simplify container requirements with the new algorithms
Status
c++14
Section
[container.requirements.general]
Submitter
Marshall Clow

Created on 2013-05-29.00:00:00 last changed 123 months ago

Messages

Date: 2013-09-26.02:33:30

Proposed resolution:

  1. Ammend [container.requirements.general], Table 96 as indicated:

    Table 96 — Container requirements (continued)
    Expression Return type Operational
    semantics
    Assertion/note
    pre-/post-condition
    Complexity
    a == b convertible to bool == is an equivalence relation.
    distance(a.begin(),
    a.end()) ==
    distance(b.begin(),
    b.end()) &&

    equal(a.begin(),
    a.end(),
    b.begin(), b.end())
    Requires: T is
    EqualityComparable
    Constant if a.size() != b.size(), linear otherwise
  2. Ammend [unord.req] p12:

    Two unordered containers a and b compare equal if a.size() == b.size() and, for every equivalent-key group [Ea1,Ea2) obtained from a.equal_range(Ea1), there exists an equivalent-key group [Eb1,Eb2) obtained from b.equal_range(Ea1), such that distance(Ea1, Ea2) == distance(Eb1, Eb2) and is_permutation(Ea1, Ea2, Eb1, Eb2) returns true. For […]
  3. Amend [forwardlist.overview] p2:

    -2- A forward_list satisfies all of the requirements of a container (Table 96), except that the size() member function is not provided and operator== has linear complexity. […]

Date: 2013-09-26.02:33:30

[ 2013-09 Chicago (evening issues) ]

Moved to ready, after confirming latest wording reflects the discussion earlier in the day.

Date: 2013-09-25.21:41:20

[ 2013-09 Chicago ]

Marshall improves wording

Date: 2013-09-25.21:41:20

[ Alisdair notes that a similar edit would apply to the unordered containers requirements. ]

Previous resolution from Marshall Clow:

Ammend the Operational Semantics for [container.requirements.general], Table 96, row "a == b"

== is an equivalence relation.
distance(a.begin(), a.end()) == distance(b.begin(), b.end()) && equal(a.begin(), a.end(), b.begin(), b.end())

Ammend [unord.req] p12:

Two unordered containers a and b compare equal if a.size() == b.size() and, for every equivalent-key group [Ea1,Ea2) obtained from a.equal_range(Ea1), there exists an equivalent-key group [Eb1,Eb2) obtained from b.equal_range(Ea1), such that distance(Ea1, Ea2) == distance(Eb1, Eb2) and is_permutation(Ea1, Ea2, Eb1, Eb2) returns true. For ...
Date: 2013-09-25.21:42:27

Currently (n3690) Table 96 says, in the row for "a == b", that the Operational semantics are:

== is an equivalence relation.
distance(a.begin(), a.end()) == distance(b.begin(), b.end()) && equal(a.begin(), a.end(),b.begin())

Given the extension of equal for C++14, this can be simplified to:

== is an equivalence relation.
equal(a.begin(), a.end(), b.begin(), b.end())
History
Date User Action Args
2014-02-27 17:03:20adminsetstatus: wp -> c++14
2014-02-20 13:52:38adminsetstatus: voting -> wp
2014-02-12 14:19:44adminsetstatus: ready -> voting
2013-09-26 02:33:30adminsetmessages: + msg6622
2013-09-26 02:33:30adminsetstatus: new -> ready
2013-09-25 21:41:20adminsetmessages: + msg6618
2013-06-02 21:43:18adminsetmessages: + msg6526
2013-06-02 21:43:18adminsetmessages: + msg6525
2013-05-29 00:00:00admincreate