5 #ifndef VCCC_ALGORITHM_RANGES_MAX_HPP
6 #define VCCC_ALGORITHM_RANGES_MAX_HPP
9 #include <initializer_list>
32 template<
typename R,
typename Proj,
typename Comp,
bool = projectable<iterator_t<R>, Proj>::value >
33 struct check_range_2 : std::false_type {};
34 template<
typename R,
typename Proj,
typename Comp>
35 struct check_range_2<R, Proj, Comp, true>
37 indirect_strict_weak_order<Comp, projected<iterator_t<R>, Proj>>,
38 indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
42 struct check_range : std::false_type {};
43 template<
typename R,
typename Proj,
typename Comp>
44 struct check_range<R, Proj, Comp, true> : check_range_2<R, Proj, Comp> {};
46 template<
typename R,
typename Proj,
typename Comp>
47 constexpr range_value_t<R>
48 max_range(R&& r, Comp comp, Proj proj, std::true_type )
const {
49 return static_cast<range_value_t<R>
>(*
ranges::max_element(r, std::ref(comp), std::ref(proj)));
52 template<
typename R,
typename Proj,
typename Comp>
53 constexpr range_value_t<R>
54 max_range(R&& r, Comp comp, Proj proj, std::false_type )
const {
57 range_value_t<R> m(*i);
66 template<
typename T,
typename Proj = identity,
typename Comp = less, std::enable_if_t<
67 indirect_strict_weak_order<Comp, projected<const T*, Proj>>
::value,
int> = 0>
69 operator()(
const T& a,
const T& b, Comp comp = {}, Proj proj = {})
const {
73 template<
typename T,
typename Proj = identity,
typename Comp = less,
74 std::enable_if_t<conjunction<
76 indirect_strict_weak_order<Comp, projected<const T*, Proj>>
79 operator()(std::initializer_list<T> r, Comp comp = {}, Proj proj = {})
const {
83 template<
typename R,
typename Proj = identity,
typename Comp = less,
85 constexpr range_value_t<R>
86 operator()(R&& r, Comp comp = {}, Proj proj = {})
const {
87 return this->max_range(std::forward<R>(r), std::ref(comp), std::ref(proj), forward_range<R>{});
constexpr VCCC_INLINE_OR_STATIC detail::max_niebloid max
Definition: max.hpp:95
constexpr VCCC_INLINE_OR_STATIC detail::max_element_niebloid max_element
Definition: max_element.hpp:61
constexpr invoke_result_t< F, Args... > invoke(F &&f, Args &&... args) noexcept(is_nothrow_invocable< F, Args... >::value)
Definition: invoke.hpp:38
constexpr VCCC_INLINE_OR_STATIC detail::begin_niebloid begin
returns an iterator to the beginning of a range
Definition: begin.hpp:116
constexpr VCCC_INLINE_OR_STATIC detail::end_niebloid end
returns a sentinel indicating the end of a range
Definition: end.hpp:120
#define VCCC_INLINE_OR_STATIC
Definition: inline_or_static.hpp:9
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35