68 :
predicates(std::forward<Predicate1>(predicate1), std::forward<Predicate2>(predicate2), std::forward<Predicates>(
predicates)...) {}
77 template<
size_t N,
typename...
Input>
inline constexpr bool impl(
Input&... input)
const {
78 if constexpr(
N >
sizeof...(Predicates)) {
90 template<
typename Predicate1,
typename Predicate2>
98 template<
typename...
Input>
100 noexcept(
noexcept(((AndPredicate::predicate1(input...)) && (AndPredicate::predicate2(input...))))) {
101 return (this->predicate1(input...)) && (this->predicate2(input...));
110 template<
typename Predicate1,
typename Predicate2,
typename Predicate3>
117 std::forward<Predicate3>(predicate2.predicate2)) {}
125 template<
typename Predicate1,
typename Predicate2,
typename Predicate3>
132 std::forward<Predicate2>(predicate1.predicate2), std::forward<Predicate3>(predicate2)) {}
141 template<
typename Predicate1,
typename Predicate2,
typename Predicate3,
typename Predicate4>
143 :
AndPredicate<Predicate1, Predicate2, Predicate3, Predicate4> {
149 std::forward<Predicate2>(predicate1.predicate2), std::forward<Predicate3>(predicate2.predicate1),
150 std::forward<Predicate3>(predicate2.predicate2)) {}
168 :
predicates(std::forward<Predicate1>(predicate1), std::forward<Predicate2>(predicate2), std::forward<Predicates>(
predicates)...) {}
178 if constexpr(
N >
sizeof...(Predicates)) {
190 template<
typename Predicate1,
typename Predicate2>
198 template<
typename...
Input>
200 noexcept(
noexcept((OrPredicate::predicate1(input...)) || (OrPredicate::predicate2(input...)))) {
201 return (this->predicate1(input...)) || (this->predicate2(input...));
210 template<
typename Predicate1,
typename Predicate2,
typename Predicate3>
217 std::forward<Predicate3>(predicate2.predicate2)) {}
225 template<
typename Predicate1,
typename Predicate2,
typename Predicate3>
232 std::forward<Predicate2>(predicate1.predicate2), std::forward<Predicate3>(predicate2)) {}
241 template<
typename Predicate1,
typename Predicate2,
typename Predicate3,
typename Predicate4>
248 std::forward<Predicate2>(predicate1.predicate2), std::forward<Predicate3>(predicate2.predicate1),
249 std::forward<Predicate3>(predicate2.predicate2)) {}
259 template<
typename...
Input>
261 return !(this->
predicate(std::forward<Input>(input)...));
278 template<
typename...
Input>
280 return callable(std::forward<Input>(input)...);
290 template<
typename Predicate1,
typename Predicate2>
306 template<
typename Predicate1,
typename Predicate2>
328 template<
typename Predicate1,
typename Predicate2>
340 template<
typename Predicate1,
typename Predicate2>
343 std::forward<Predicate2>(
static_cast<Predicate2&&
>(predicate2)));
352 template<
typename Predicate1,
typename Predicate2>
364 template<
typename Predicate1,
typename Predicate2>
367 std::forward<Predicate2>(
static_cast<Predicate2&&
>(predicate2)));
399 template<
typename T> [[
nodiscard]]
inline constexpr auto eq(
T value)
noexcept {
400 return predicate([value = std::forward<T>(value)](
const auto& input)
constexpr noexcept(
noexcept(input == value)) {
return input == value; });
408 template<
typename T> [[
nodiscard]]
inline constexpr auto neq(
T value)
noexcept {
409 return predicate([value = std::forward<T>(value)](
const auto& input)
constexpr noexcept(
noexcept(input != value)) {
return input != value; });
417 template<
typename T> [[
nodiscard]]
inline constexpr auto gt(
T value)
noexcept {
418 return predicate([value = std::forward<T>(value)](
const auto& input)
constexpr noexcept(
noexcept(input > value)) {
return input > value; });
426 template<
typename T> [[
nodiscard]]
inline constexpr auto gte(
T value)
noexcept {
427 return predicate([value = std::forward<T>(value)](
const auto& input)
constexpr noexcept(
noexcept(input >= value)) {
return input >= value; });
435 template<
typename T> [[
nodiscard]]
inline constexpr auto lt(
T value)
noexcept {
436 return predicate([value = std::forward<T>(value)](
const auto& input)
constexpr noexcept(
noexcept(input < value)) {
return input < value; });
444 template<
typename T> [[
nodiscard]]
inline constexpr auto lte(
T value)
noexcept {
445 return predicate([value = std::forward<T>(value)](
const auto& input)
constexpr noexcept(
noexcept(input <= value)) {
return input <= value; });
Tuple is a fixed-size collection of heterogeneous values.
Definition Tuple.hpp:15
Definition Application.hpp:19
constexpr auto lt(T value) noexcept
Creates a new predicate that compares the input object with value using < operator.
Definition Predicate.hpp:435
constexpr auto neq(T value) noexcept
Creates a new predicate that compares the input object with value using != operator.
Definition Predicate.hpp:408
constexpr auto gte(T value) noexcept
Creates a new predicate that compares the input object with value using >= operator.
Definition Predicate.hpp:426
constexpr auto operator||(const Predicate< Predicate1 > &predicate1, const Predicate< Predicate2 > &predicate2) noexcept
Helper operator to create a new OrPredicate from two predicates.
Definition Predicate.hpp:353
constexpr auto gt(T value) noexcept
Creates a new predicate that compares the input object with value using > operator.
Definition Predicate.hpp:417
constexpr auto lte(T value) noexcept
Creates a new predicate that compares the input object with value using <= operator.
Definition Predicate.hpp:444
constexpr auto operator&&(const Predicate< Predicate1 > &predicate1, const Predicate< Predicate2 > &predicate2) noexcept
Helper operator to create a new AndPredicate from two predicates.
Definition Predicate.hpp:329
constexpr auto predicate(Callable &&callable) noexcept
Helper function to create a new predicate from a lambda.
Definition Predicate.hpp:390
constexpr auto eq(T value) noexcept
Creates a new predicate that compares the input object with value using == operator.
Definition Predicate.hpp:399
@ Input
Determines that the socket takes a value as input.
constexpr auto operator!(const Predicate< TPredicate > &predicate) noexcept
Helper operator to create a new OrPredicate from two predicates.
Definition Predicate.hpp:374
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
constexpr AndPredicate(AndPredicate< Predicate1, Predicate2 > &&predicate1, Predicate3 &&predicate2) noexcept
Creates a new AndPredicate.
Definition Predicate.hpp:130
constexpr AndPredicate(AndPredicate< Predicate1, Predicate2 > &&predicate1, AndPredicate< Predicate3, Predicate4 > &&predicate2) noexcept
Creates a new AndPredicate.
Definition Predicate.hpp:147
constexpr AndPredicate(NotPredicate< Predicate1 > &&predicate1, NotPredicate< Predicate2 > &&predicate2) noexcept
Creates a new AndPredicate and applies the "De Morgan" law.
Definition Predicate.hpp:295
constexpr AndPredicate(Predicate1 &&predicate1, AndPredicate< Predicate2, Predicate3 > &&predicate2) noexcept
Creates a new AndPredicate.
Definition Predicate.hpp:115
constexpr bool operator()(Input &&... input) const noexcept(noexcept(((AndPredicate::predicate1(input...)) &&(AndPredicate::predicate2(input...)))))
Executes the predicate.
Definition Predicate.hpp:99
A predicate implementation that performs a logical AND between other predicates.
Definition Predicate.hpp:59
constexpr bool impl(Input &... input) const
Definition Predicate.hpp:77
constexpr bool operator()(Input &&... input) const
Executes the predicate.
Definition Predicate.hpp:74
Tuple< Predicate1, Predicate2, Predicates... > predicates
A tuple containing the predicates to apply the logical AND on.
Definition Predicate.hpp:61
constexpr AndPredicate(Predicate1 &&predicate1, Predicate2 &&predicate2, Predicates &&... predicates) noexcept
Creates a new AndPredicate.
Definition Predicate.hpp:67
A predicate that operates using two other predicates as-if a binary operation.
Definition Predicate.hpp:26
Predicate1 predicate1
The left-hand side predicate.
Definition Predicate.hpp:28
constexpr BinaryPredicate(Predicate1 &&predicate1, Predicate2 &&predicate2) noexcept
Creates a new BinaryPredicate.
Definition Predicate.hpp:36
Predicate2 predicate2
The right-hand side predicate.
Definition Predicate.hpp:31
Definition NamedType.hpp:237
constexpr NotPredicate(NotPredicate< TPredicate > &&predicate)
Definition Predicate.hpp:319
Definition Predicate.hpp:252
constexpr bool operator()(Input &&... input) const noexcept(noexcept(NotPredicate::predicate(std::forward< Input >(input)...)))
Executes the predicate.
Definition Predicate.hpp:260
constexpr OrPredicate(NotPredicate< Predicate1 > &&predicate1, NotPredicate< Predicate2 > &&predicate2) noexcept
Creates a new OrPredicate and applies the "De Morgan" law.
Definition Predicate.hpp:311
constexpr OrPredicate(OrPredicate< Predicate1, Predicate2 > &&predicate1, Predicate3 &&predicate2) noexcept
Creates a new OrPredicate.
Definition Predicate.hpp:230
constexpr OrPredicate(OrPredicate< Predicate1, Predicate2 > &&predicate1, OrPredicate< Predicate3, Predicate4 > &&predicate2) noexcept
Creates a new OrPredicate.
Definition Predicate.hpp:246
constexpr OrPredicate(Predicate1 &&predicate1, OrPredicate< Predicate2, Predicate3 > &&predicate2) noexcept
Creates a new OrPredicate.
Definition Predicate.hpp:215
constexpr bool operator()(Input &&... input) const noexcept(noexcept((OrPredicate::predicate1(input...))||(OrPredicate::predicate2(input...))))
Executes the predicate.
Definition Predicate.hpp:199
A predicate implementation that performs a logical OR between other predicates.
Definition Predicate.hpp:159
constexpr OrPredicate(Predicate1 &&predicate1, Predicate2 &&predicate2, Predicates &&... predicates) noexcept
Creates a new OrPredicate.
Definition Predicate.hpp:167
constexpr bool impl(Input &... input) const
Definition Predicate.hpp:177
Tuple< Predicate1, Predicate2, Predicates... > predicates
A tuple containing the predicates to apply the logical OR on.
Definition Predicate.hpp:161
constexpr bool operator()(Input &&... input) const
Executes the predicate.
Definition Predicate.hpp:174
A type that predicate types must extend to allow automatic operator overloading.
Definition Predicate.hpp:19
A predicate that operates using two other predicates as-if a unary operation.
Definition Predicate.hpp:44
TPredicate predicate
The operand predicate.
Definition Predicate.hpp:46
constexpr UnaryPredicate(TPredicate &&predicate) noexcept
Creates a new UnaryPredicate.
Definition Predicate.hpp:50
Definition Predicate.hpp:265
constexpr UserPredicate(Callable &&callable) noexcept
Creates a new UserPredicate
Definition Predicate.hpp:272
constexpr bool operator()(Input &&... input) const noexcept(noexcept(callable(std::forward< Input >(input)...)))
Executes the predicate.
Definition Predicate.hpp:279
Callable callable
The callable to be invoked when evaluating the predicate.
Definition Predicate.hpp:267