di 0.1.0
Loading...
Searching...
No Matches
any_of.h
Go to the documentation of this file.
1#pragma once
2
5
6namespace di::container {
7namespace detail {
8 struct AnyOfFunction {
9 template<concepts::InputIterator Iter, concepts::SentinelFor<Iter> Sent, typename Proj = function::Identity,
10 concepts::IndirectUnaryPredicate<meta::Projected<Iter, Proj>> Pred = function::AsBool>
11 constexpr auto operator()(Iter first, Sent last, Pred pred = {}, Proj proj = {}) const -> bool {
12 return container::find_if(util::move(first), last, util::ref(pred), util::ref(proj)) != last;
13 }
14
15 template<concepts::InputContainer Con, typename Proj = function::Identity,
16 concepts::IndirectUnaryPredicate<meta::Projected<meta::ContainerIterator<Con>, Proj>> Pred =
17 function::AsBool>
18 constexpr auto operator()(Con&& container, Pred pred = {}, Proj proj = {}) const -> bool {
19 return (*this)(container::begin(container), container::end(container), util::ref(pred), util::ref(proj));
20 }
21 };
22}
23
24constexpr inline auto any_of = detail::AnyOfFunction {};
25}
26
27namespace di {
29}
constexpr auto last(concepts::detail::ConstantVector auto &vector, size_t count)
Definition vector_last.h:13
Definition sequence.h:12
constexpr auto find_if
Definition find_if.h:31
constexpr auto end
Definition end.h:55
constexpr auto any_of
Definition any_of.h:24
constexpr auto begin
Definition begin.h:52
constexpr auto ref
Definition reference_wrapper.h:98
Definition any_storable.h:9
constexpr auto proj
Definition proj.h:59