Date
2023-02-13.10:17:57
Message id
13348

Content

Proposed resolution:

This wording is relative to N4917.

  1. Change [push.heap] as indicated:

    template<class RandomAccessIterator>
      constexpr void push_heap(RandomAccessIterator first, RandomAccessIterator last);
    
    template<class RandomAccessIterator, class Compare>
      constexpr void push_heap(RandomAccessIterator first, RandomAccessIterator last,
                               Compare comp);
                     
    template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
             class Proj = identity>
      requires sortable<I, Comp, Proj>
      constexpr I
        ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {});
    template<random_access_range R, class Comp = ranges::less, class Proj = identity>
      requires sortable<iterator_t<R>, Comp, Proj>
      constexpr borrowed_iterator_t<R>
        ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {});
    

    -1- Let comp be less{} and proj be identity{} for the overloads with no parameters by those names.

    -2- Preconditions: The range [first, last - 1) is a valid heap with respect to comp and proj. For the overloads in namespace std, RandomAccessIterator meets the Cpp17ValueSwappable requirements ([swappable.requirements]) and the type of *first meets the Cpp17MoveConstructible requirements (Table 32) and the Cpp17MoveAssignable requirements (Table 34).

    -3- Effects: Places the value in the location last - 1 into the resulting heap [first, last).

    -4- Returns: last for the overloads in namespace ranges.

    -5- Complexity: At most log(last - first) comparisons and twice as many projections.

  2. Change [make.heap] as indicated:

    template<class RandomAccessIterator>
      constexpr void make_heap(RandomAccessIterator first, RandomAccessIterator last);
    
    template<class RandomAccessIterator, class Compare>
      constexpr void make_heap(RandomAccessIterator first, RandomAccessIterator last,
                               Compare comp);
                               
    template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
             class Proj = identity>
      requires sortable<I, Comp, Proj>
      constexpr I
        ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {});
    template<random_access_range R, class Comp = ranges::less, class Proj = identity>
      requires sortable<iterator_t<R>, Comp, Proj>
      constexpr borrowed_iterator_t<R>
        ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {});
    

    -1- Let comp be less{} and proj be identity{} for the overloads with no parameters by those names.

    -2- Preconditions: For the overloads in namespace std, RandomAccessIterator meets the Cpp17ValueSwappable requirements ([swappable.requirements]) and the type of *first meets the Cpp17MoveConstructible (Table 32) and Cpp17MoveAssignable (Table 34) requirements.

    -3- Effects: Constructs a heap with respect to comp and proj out of the range [first, last).

    -4- Returns: last for the overloads in namespace ranges.

    -5- Complexity: At most 3(last - first) comparisons and twice as many projections.