6#ifndef SIMPLE_UTILITY_FUNCTIONAL_MIXINS_EQUALITY_HPP
7#define SIMPLE_UTILITY_FUNCTIONAL_MIXINS_EQUALITY_HPP
22 template <
class... PackedFns,
class... Args>
23 requires (... && std::predicate<PackedFns, Args...>)
25 constexpr bool operator ()(
26 std::tuple<PackedFns...>&& fnPack,
29 noexcept((... && std::is_nothrow_invocable_v<PackedFns, Args...>))
32 [&]<
class FirstFn,
class... OtherFns>(FirstFn&& firstFn, OtherFns&&... otherFns)
34 const auto& firstResult = std::invoke(std::forward<FirstFn>(firstFn), args...);
37 const auto equalResults = [&]<
class Fn>(Fn&& fn)
39 return firstResult == std::invoke(std::forward<Fn>(fn), args...);
41 return (equalResults(std::forward<OtherFns>(otherFns)) && ...);
47 template <concepts::unqualified Derived>
57 static_assert(std::is_base_of_v<EqualityOperator, Derived>,
"Derived doesn't inherit from EqualityOperator.");
59 std::copy_constructible<Derived> || std::move_constructible<Derived>,
60 "Derived is neither move- nor copy-constructible.");
74 template <
class Other>
80 )
noexcept(
noexcept(make_composition<Strategy>(first, std::declval<Other>())))
82 return envelop<closure_template<Derived>::template type>(
83 make_composition<Strategy>(first, std::forward<Other>(other)));
86 template <
class Other>
92 )
noexcept(
noexcept(make_composition<Strategy>(std::move(first), std::declval<Other>())))
94 return envelop<closure_template<Derived>::template type>(
95 make_composition<Strategy>(std::move(first), std::forward<Other>(other)));
Definition: Equality.hpp:49
EqualityOperator & operator=(const EqualityOperator &)=default
EqualityOperator(const EqualityOperator &)=default
friend constexpr auto operator==(const Derived &first, Other &&other) noexcept(noexcept(make_composition< Strategy >(first, std::declval< Other >())))
Definition: Equality.hpp:77
EqualityOperator(EqualityOperator &&)=default
constexpr EqualityOperator() noexcept
Definition: Equality.hpp:55
~EqualityOperator()=default
Determines whether the given type satisfies the constraints of a function type.
Definition: BasicClosure.hpp:79
Definition: Arithmetic.hpp:13
Definition: Equality.hpp:21