Created on 2014-02-21.00:00:00 last changed 89 months ago
Proposed resolution:
This wording is relative to N3936.
In [algorithms.general], header <algorithm> synopsis, and [alg.min.max], change as indicated (add constexpr to every signature from the first min_element to the second minmax_element)::
template<class ForwardIterator> constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last); template<class ForwardIterator, class Compare> constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last, Compare comp); […] template<class ForwardIterator> constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last); template<class ForwardIterator, class Compare> constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last, Compare comp); […] template<class ForwardIterator> constexpr pair<ForwardIterator, ForwardIterator> minmax_element(ForwardIterator first, ForwardIterator last); template<class ForwardIterator, class Compare> constexpr pair<ForwardIterator, ForwardIterator> minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
[ 2015-02 Cologne ]
AM: Can we implement this with the C++14 constexpr rules? JM: Yes. AM: Ready? [Yes]
Accepted.As part of the resolution for LWG issue 2350, max(initializer_list) was marked as constexpr. Looking at two implementations of this function (libstdc++ and libc++), both implement it in terms of max_element, which is not marked as constexpr. This is inconsistent and forces some small amount of code duplication in the implementation. Unless we remove constexpr from this overload of max, I believe we should add constexpr to max_element.
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-07-30 20:15:43 | admin | set | status: wp -> c++17 |
2015-05-22 18:31:21 | admin | set | status: ready -> wp |
2015-03-29 16:56:20 | admin | set | messages: + msg7267 |
2015-03-29 16:56:20 | admin | set | status: new -> ready |
2014-03-24 22:19:13 | admin | set | messages: + msg6912 |
2014-02-21 00:00:00 | admin | create |