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

### 2727. Parallel algorithms with `constexpr` specifier

Section: 25.1 [algorithms.general] Status: C++17 Submitter: Jonathan Wakely Opened: 2016-06-21 Last modified: 2017-07-30

Priority: 0

View all issues with C++17 status.

Discussion:

In LEWG we noticed some parallel algorithms are `constexpr`. Jared said:

I think this is an oversight, and it also applies to `std::max_element`/`std::minmax_element`. To my knowledge, neither SG1 nor LWG ever explicitly considered whether a parallel algorithm should be `constexpr`. I think the assumption was that parallel algorithms would be regular old function templates without additional specifiers such as `constexpr`.

[2016-06 Oulu]

Moved to P0/Ready during issues prioritization.

Friday: status to Immediate

Proposed resolution:

This wording is relative to N4594.

1. Change the `<algorithm>` header synopsis, 25.1 [algorithms.general], as indicated, to remove "`constexpr`" from the six `{min,max,minmax}_element` overloads with an `ExecutionPolicy` argument:

   >     namespace std {

   >     […]
   >     // 25.5.7, minimum and maximum:
   >     […]
   >     template<class ExecutionPolicy, class ForwardIterator>
   >       constexpr ForwardIterator min_element(ExecutionPolicy&& exec, // see 25.2.5
   >                                             ForwardIterator first, ForwardIterator last);
   >     template<class ExecutionPolicy, class ForwardIterator, class Compare>
   >       constexpr ForwardIterator min_element(ExecutionPolicy&& exec, // see 25.2.5
   >                                             ForwardIterator first, ForwardIterator last,
   >                                             Compare comp);
   >     […]
   >     template<class ExecutionPolicy, class ForwardIterator>
   >       constexpr ForwardIterator max_element(ExecutionPolicy&& exec, // see 25.2.5
   >                                             ForwardIterator first, ForwardIterator last);
   >     template<class ExecutionPolicy, class ForwardIterator, class Compare>
   >       constexpr ForwardIterator max_element(ExecutionPolicy&& exec, // see 25.2.5
   >                                             ForwardIterator first, ForwardIterator last,
   >                                             Compare comp);
   >     […]
   >     template<class ExecutionPolicy, class ForwardIterator>
   >       constexpr pair<ForwardIterator, ForwardIterator>
   >         minmax_element(ExecutionPolicy&& exec, // see 25.2.5
   >                        ForwardIterator first, ForwardIterator last);
   >     template<class ExecutionPolicy, class ForwardIterator, class Compare>
   >       constexpr pair<ForwardIterator, ForwardIterator>
   >         minmax_element(ExecutionPolicy&& exec, // see 25.2.5
   >                        ForwardIterator first, ForwardIterator last, Compare comp);
   >     […]
   >     }