Date
2023-02-13.11:31:32
Message id
13404

Content

Proposed resolution:

This wording is relative to n4928.

  1. Modify [flat.set.erasure] as indicated:

    template<class Key, class Compare, class KeyContainer, class Predicate>
      typename flat_set<Key, Compare, KeyContainer>::size_type
        erase_if(flat_set<Key, Compare, KeyContainer>& c, Predicate pred);
    

    -1- Effects: Equivalent to:

    auto [erase_first, erase_last] = ranges::remove_if(c, pred);
    auto n = erase_last - erase_first;
    c.erase(erase_first, erase_last);
    return n;
    

    -1- Preconditions: Key meets the Cpp17MoveAssignable requirements.

    -2- Effects: Let E be bool(pred(as_const(e))). Erases all elements e in c for which E holds.

    -3- Returns: The number of elements erased.

    -4- Complexity: Exactly c.size() applications of the predicate.

    -5- Remarks: Stable ([algorithm.stable]). If an invocation of erase_if exits via an exception, c is in a valid but unspecified state ([defns.valid]).

    [Note 1: c still meets its invariants, but can be empty. — end note]

  2. Modify [flat.multiset.erasure] as indicated:

    template<class Key, class Compare, class KeyContainer, class Predicate>
      typename flat_multiset<Key, Compare, KeyContainer>::size_type
        erase_if(flat_multiset<Key, Compare, KeyContainer>& c, Predicate pred);
    

    -1- Effects: Equivalent to:

    auto [erase_first, erase_last] = ranges::remove_if(c, pred);
    auto n = erase_last - erase_first;
    c.erase(erase_first, erase_last);
    return n;
    

    -1- Preconditions: Key meets the Cpp17MoveAssignable requirements.

    -2- Effects: Let E be bool(pred(as_const(e))). Erases all elements e in c for which E holds.

    -3- Returns: The number of elements erased.

    -4- Complexity: Exactly c.size() applications of the predicate.

    -5- Remarks: Stable ([algorithm.stable]). If an invocation of erase_if exits via an exception, c is in a valid but unspecified state ([defns.valid]).

    [Note 1: c still meets its invariants, but can be empty. — end note]