22 class Proj = std::identity,
23 std::indirect_strict_weak_order<std::projected<const T*, Proj>>
Comp = std::ranges::less
27 return std::ranges::max(a, b, std::ref(
comp), std::ref(
proj));
33 class Proj = std::identity,
34 std::indirect_strict_weak_order<std::projected<const T*, Proj>>
Comp = std::ranges::less
38 return std::ranges::min(a, b, std::ref(
comp), std::ref(
proj));
44 class Proj = std::identity,
45 std::indirect_strict_weak_order<std::projected<const T*, Proj>>
Comp = std::ranges::less
49 return std::ranges::clamp(
v,
lo,
hi, std::ref(
comp), std::ref(
proj));
54 std::ranges::random_access_range
R,
55 class Proj = std::identity,
56 std::indirect_strict_weak_order<std::projected<std::ranges::iterator_t<R>,
Proj>>
Comp = std::ranges::less
60 const auto first = std::ranges::begin(r);
61 return std::distance(
first, std::ranges::max_element(
first, std::ranges::end(r), std::ref(
comp), std::ref(
proj)));
65 template<std::ranges::random_access_range R>
66 requires std::ranges::borrowed_range<R>
67 constexpr std::ranges::range_reference_t<R>
at(
R&& r, std::ranges::range_size_t<R>
pos)
69 if (
pos < std::ranges::size(r)) {
70 return std::forward<R>(r)[
pos];
73 throw std::out_of_range{
"out of bounds index given to a container"};
79 std::ranges::input_range
R,
81 typename Proj = std::identity
84 std::indirect_binary_predicate<std::ranges::equal_to, std::projected<std::ranges::iterator_t<R>,
Proj>,
const T*>
87 const auto it = std::ranges::find(r, value, std::ref(
proj));
88 return it != std::ranges::end(r) ? std::optional<std::ranges::range_value_t<R>>{*
it} : std::nullopt;
92 template<AssociativeContainer Lookup, AssociativeContainerKeyFor<Lookup> Key>
95 if (
const auto it = lookup.find(key);
it != lookup.end()) {
103 std::ranges::input_range
R,
105 typename Proj = std::identity
107 requires std::ranges::borrowed_range<R>
110 const auto it = std::ranges::find(r, value, std::move(
proj));
111 return it != std::ranges::end(r) ? std::addressof(*
it) :
nullptr;
115 template<AssociativeContainer T, AssociativeContainerKeyFor<T> Key>
121 return std::addressof(
it->second);
127 template<AssociativeContainer T, AssociativeContainerKeyFor<T> Key>
133 return std::addressof(
it->second);
139 template<
typename Downcasted,
typename T1,
typename T2>
141 std::equality_comparable<Downcasted>
and
142 std::is_polymorphic_v<Downcasted>
and
143 std::derived_from<Downcasted, T1>
and
144 std::derived_from<Downcasted, T2>
155 template<std::ranges::range R1, std::ranges::input_range R2>
157 std::convertible_to<std::ranges::range_value_t<R2>, std::ranges::range_value_t<R1>>
and
158 requires (
R1&
r1, std::ranges::iterator_t<R1>
it, std::ranges::iterator_t<R2>
first, std::ranges::sentinel_t<R2>
last) {
r1.insert(
it,
first,
last); }
161 r1.insert(std::ranges::end(
r1), std::ranges::begin(
r2), std::ranges::end(
r2));
Definition custom_decoration_generator.h:5
constexpr auto min(Angle< Rep1, Units1 > x, Angle< Rep2, Units2 > y) -> std::common_type_t< decltype(x), decltype(y)>
Definition angle.h:267
constexpr Angle< Rep, Units > clamp(const Angle< Rep, Units > &v, const AngleMin &min, const AngleMax &max)
Definition angle.h:303
constexpr void append_range(R1 &r1, R2 &&r2)
Definition algorithms.h:159
auto find_or_nullptr(R &&r, const T &value, Proj proj={}) -> decltype(std::addressof(*std::ranges::begin(r)))
Definition algorithms.h:108
std::optional< std::ranges::range_value_t< R > > find_or_nullopt(R &&r, const T &value, Proj proj={})
Definition algorithms.h:85
constexpr std::ranges::range_reference_t< R > at(R &&r, std::ranges::range_size_t< R > pos)
Definition algorithms.h:67
constexpr auto max(Angle< Rep1, Units1 > x, Angle< Rep2, Units2 > y) -> std::common_type_t< decltype(x), decltype(y)>
Definition angle.h:283
auto * lookup_or_nullptr(const T &container, const Key &key)
Definition algorithms.h:116
and std::is_polymorphic_v< Downcasted > and std::derived_from< Downcasted, T1 > and std::derived_from< Downcasted, T2 > constexpr bool is_eq_downcasted(const T1 &lhs, const T2 &rhs)
Definition algorithms.h:145
constexpr U to(T &&value)
Definition conversion.h:56
std::optional< typename Lookup::mapped_type > lookup_or_nullopt(const Lookup &lookup, const Key &key)
Definition algorithms.h:93
constexpr std::ranges::range_size_t< R > max_element_index(R &&r, Comp comp={}, Proj proj={})
Definition algorithms.h:58
and
Definition algorithms.h:158