3032. ValueSwappable requirement missing for push_heap and make_heap

Section: 28.7.7 [alg.heap.operations] Status: New Submitter: Robert Douglas Opened: 2017-11-08 Last modified: 2017-11-09

Priority: 3

View all other issues in [alg.heap.operations].

View all issues with New status.

Discussion:

In discussion of D0202R3 in Albuquerque, it was observed that pop_heap and sort_heap had constexpr removed for their requirement of ValueSwappable. It was then observed that push_heap and make_heap were not similarly marked as having the ValueSwappable requirement. The room believed this was likely a specification error, and asked to open an issue to track it.

[2017-11 Albuquerque Wednesday night issues processing]

Priority set to 3; Marshall to investigate

Proposed resolution:

This wording is relative to N4700.

  1. Change 28.7.7.1 [push.heap] as indicated:

    template<class RandomAccessIterator>
      void push_heap(RandomAccessIterator first, RandomAccessIterator last);
    template<class RandomAccessIterator, class Compare>
      void push_heap(RandomAccessIterator first, RandomAccessIterator last,
                     Compare comp);
    

    -1- Requires: The range [first, last - 1) shall be a valid heap. RandomAccessIterator shall satisfy the requirements of ValueSwappable (20.5.3.2 [swappable.requirements]). The type of *first shall satisfy the MoveConstructible requirements (Table 23) and the MoveAssignable requirements (Table 25).

  2. Change 28.7.7.3 [make.heap] as indicated:

    template<class RandomAccessIterator>
      void make_heap(RandomAccessIterator first, RandomAccessIterator last);
    template<class RandomAccessIterator, class Compare>
      void make_heap(RandomAccessIterator first, RandomAccessIterator last,
                     Compare comp);
    

    -1- Requires: RandomAccessIterator shall satisfy the requirements of ValueSwappable (20.5.3.2 [swappable.requirements]). The type of *first shall satisfy the MoveConstructible requirements (Table 23) and the MoveAssignable requirements (Table 25).