This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

### 3032. `ValueSwappable` requirement missing for `push_heap` and `make_heap`

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

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 25.8.8.2 [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` (16.4.4.3 [swappable.requirements]). The type of `*first` shall satisfy the `MoveConstructible` requirements (Table 23) and the `MoveAssignable` requirements (Table 25).

2. Change 25.8.8.4 [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` (16.4.4.3 [swappable.requirements]). The type of `*first` shall satisfy the `MoveConstructible` requirements (Table 23) and the `MoveAssignable` requirements (Table 25).