14#ifndef RANGES_V3_ALGORITHM_MAX_HPP
15#define RANGES_V3_ALGORITHM_MAX_HPP
17#include <initializer_list>
29#include <range/v3/utility/static_const.hpp>
31#include <range/v3/detail/prologue.hpp>
37 RANGES_FUNC_BEGIN(max)
42 constexpr T const & RANGES_FUNC(max)(
43 T const & a, T const & b, C pred = C{}, P proj = P{})
49 template(
typename Rng,
typename C =
less,
typename P = identity)(
50 requires input_range<Rng> AND
51 indirect_strict_weak_order<C, projected<iterator_t<Rng>, P>> AND
52 indirectly_copyable_storable<iterator_t<Rng>, range_value_t<Rng> *>)
53 constexpr range_value_t<Rng>
54 RANGES_FUNC(max)(Rng && rng, C pred = C{}, P proj = P{})
56 auto first = ranges::begin(rng);
57 auto last = ranges::end(rng);
58 RANGES_EXPECT(first != last);
59 range_value_t<Rng> result = *
first;
60 while(++first != last)
64 result = (
decltype(tmp) &&)tmp;
70 template(
typename T,
typename C =
less,
typename P = identity)(
71 requires copyable<T> AND
72 indirect_strict_weak_order<C, projected<T const *, P>>)
73 constexpr T RANGES_FUNC(max)(
74 std::initializer_list<T>
const && rng, C pred = C{}, P proj = P{})
76 return (*
this)(rng, std::move(pred), std::move(proj));
88#include <range/v3/detail/epilogue.hpp>
The indirect_strict_weak_order concept.
typename Fn::template invoke< Args... > invoke
Evaluate the invocable Fn with the arguments Args.
Definition meta.hpp:541
front< Pair > first
Retrieve the first element of the pair Pair.
Definition meta.hpp:2251
bool_<(T::type::value< U::type::value)> less
A Boolean integral constant wrapper around true if T::type::value is less than U::type::value; false,...
Definition meta.hpp:255
Definition identity.hpp:25
Definition comparisons.hpp:50