6#ifndef SIMPLE_UTILITY_FUNCTIONAL_MIXINS_PIPE_HPP
7#define SIMPLE_UTILITY_FUNCTIONAL_MIXINS_PIPE_HPP
23 template <
class Fn,
class... Args>
24 requires std::invocable<Fn, Args...>
25 constexpr decltype(
auto)
operator ()(
28 )
const noexcept(std::is_nothrow_invocable_v<Fn, Args...>)
30 return std::invoke(std::get<0>(std::move(fn)), std::forward<Args>(args)...);
34 requires std::invocable<type_list::front_t<Fns>, Args...>
38 std::invoke_result_t<type_list::front_t<Fns>, Args...>>
39 constexpr decltype(
auto)
operator ()(
51 [&]<
class FirstFn,
class... OtherFns>(FirstFn&& first, OtherFns&&... others)
53 return std::make_tuple(
54 std::forward_as_tuple(std::forward<OtherFns>(others)...),
55 std::invoke(std::forward<FirstFn>(first), std::forward<Args>(args)...));
61 template <concepts::unqualified Derived>
68 static_assert(std::is_base_of_v<PipeOperator, Derived>,
"Derived doesn't inherit from PipeOperator.");
70 std::copy_constructible<Derived> || std::move_constructible<Derived>,
71 "Derived is neither move- nor copy-constructible.");
85 template <
class Other>
87 && std::same_as<unwrap_functional_t<Other>, Other>
92 )
noexcept(
noexcept(make_composition<PipeStrategy>(first, std::declval<Other>())))
94 return envelop<closure_template<Derived>::template type>(
95 make_composition<PipeStrategy>(first, std::forward<Other>(other)));
98 template <
class Other>
102 const Derived& first,
104 )
noexcept(
noexcept(make_composition<PipeStrategy>(first, std::declval<Other>())))
106 return envelop<closure_template<std::remove_cvref_t<Other>>::template type>(
107 make_composition<PipeStrategy>(first, std::forward<Other>(other)));
110 template <
class Other>
112 && std::same_as<unwrap_functional_t<Other>, Other>
117 )
noexcept(
noexcept(make_composition<PipeStrategy>(std::move(first), std::declval<Other>())))
119 return envelop<closure_template<Derived>::template type>(
120 make_composition<PipeStrategy>(std::move(first), std::forward<Other>(other)));
123 template <
class Other>
129 )
noexcept(
noexcept(make_composition<PipeStrategy>(std::move(first), std::declval<Other>())))
131 return envelop<closure_template<std::remove_cvref_t<Other>>::template type>(
132 make_composition<PipeStrategy>(std::move(first), std::forward<Other>(other)));
PipeOperator(PipeOperator &&)=default
constexpr PipeOperator() noexcept
Definition: Pipe.hpp:66
PipeOperator & operator=(const PipeOperator &)=default
friend constexpr auto operator|(const Derived &first, Other &&other) noexcept(noexcept(make_composition< PipeStrategy >(first, std::declval< Other >())))
Definition: Pipe.hpp:89
PipeOperator(const PipeOperator &)=default
Determines whether a type can be used as a tuple-like.
Definition: General.hpp:105
Determines whether the given type satisfies the constraints of a function type.
Definition: BasicClosure.hpp:79
typename front< List >::type front_t
Convenience alias, exposing the type member alias of the front trait.
Definition: TypeList.hpp:431
typename pop_front< List >::type pop_front_t
Convenience alias, exposing the type member alias of the pop_front trait.
Definition: TypeList.hpp:780
Definition: Arithmetic.hpp:13