|
|
@@ -43,20 +43,23 @@ auto minmax_element(It it, S end, Comp comp = {}, Proj proj = {}) {
|
|
|
template <typename Stream, typename Comp = std::less<>,
|
|
|
typename Proj = detail::identity>
|
|
|
auto minmax_element(Stream const & stream, Comp comp = {}, Proj proj = {}) {
|
|
|
- return minmax_element(stream.begin(), stream.end(), comp, proj);
|
|
|
+ return minmax_element(stream.begin(), stream.end(), std::ref(comp),
|
|
|
+ std::ref(proj));
|
|
|
}
|
|
|
|
|
|
template <typename T, typename Comp = std::less<>,
|
|
|
typename Proj = detail::identity>
|
|
|
auto minmax(std::initializer_list<T> stream, Comp comp = {}, Proj proj = {}) {
|
|
|
- auto result = minmax_element(stream.begin(), stream.end(), comp, proj);
|
|
|
+ auto result = minmax_element(stream.begin(), stream.end(), std::ref(comp),
|
|
|
+ std::ref(proj));
|
|
|
return detail::min_max_result(*result.min, *result.max);
|
|
|
}
|
|
|
|
|
|
template <typename Stream, typename Comp = std::less<>,
|
|
|
typename Proj = detail::identity>
|
|
|
auto minmax(Stream const & stream, Comp comp = {}, Proj proj = {}) {
|
|
|
- auto result = minmax_element(stream.begin(), stream.end(), comp, proj);
|
|
|
+ auto result = minmax_element(stream.begin(), stream.end(), std::ref(comp),
|
|
|
+ std::ref(proj));
|
|
|
return detail::min_max_result(*result.min, *result.max);
|
|
|
}
|
|
|
}
|