Created on 2018-12-21.00:00:00 last changed 46 months ago
Proposed resolution:
This wording is relative to N4791.
Change [algorithm.syn] as indicated, and adjust the declarations of std::ranges::minmax_element in [alg.min.max] to agree:
[…] template<class ExecutionPolicy, class ForwardIterator, class Compare> pair<ForwardIterator, ForwardIterator> minmax_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] ForwardIterator first, ForwardIterator last, Compare comp); namespace ranges { template<class I> using minmax_element_result = minmax_result<I>; template<ForwardIterator I, Sentinel<I> S, class Proj = identity, IndirectStrictWeakOrder<projected<I, Proj>> Comp = ranges::less<>> constexpr minmax_element_result<I> minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); template<ForwardRange R, class Proj = identity, IndirectStrictWeakOrder<projected<iterator_t<R>, Proj>> Comp = ranges::less<>> constexpr minmax_element_result<safe_iterator_t<R>> minmax_element(R&& r, Comp comp = {}, Proj proj = {}); } // [alg.clamp], bounded value […]
[ 2019-01-11 Status to Tentatively Ready after five positive votes on the reflector. ]
During that reflector discussion several contributers questioned the choice of alias templates to denote algorithm result types or particular aspects of it. Since this approach had been approved by LEWG before, it was suggested to those opponents to instead write a paper, because changing this as part of this issue would be a design change that would require a more global fixing approach.
The overloads of std::ranges::minmax_element are specified to return std::ranges::minmax_result, which is inconsistent with the intended design. When an algorithm foo returns an aggregate of multiple results, the return type should be named foo_result. The spec should introduce an alias minmax_element_result for minmax_result and use that alias as the return type of the std::ranges::minmax_element overloads.
History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2019-02-26 17:40:23 | admin | set | status: voting -> wp |
2019-01-21 04:50:04 | admin | set | status: ready -> voting |
2019-01-12 16:18:42 | admin | set | messages: + msg10277 |
2019-01-12 16:18:42 | admin | set | status: new -> ready |
2018-12-21 21:22:01 | admin | set | messages: + msg10272 |
2018-12-21 00:00:00 | admin | create |