6#ifndef _CPG_FUNCTIONAL_HPP
7#define _CPG_FUNCTIONAL_HPP
26 template<
typename FuncType>
30 std::invoke(func, this->value);
33 this->value = std::invoke(func, this->value);
38 template<
typename InputType,
typename... FuncTypes>
39 decltype(
auto)
operator|( std::tuple<FuncTypes...>
const& func, std::vector<InputType>
const& input )
41 using vector_t = std::vector<InputType>;
45 auto process = [&](
auto k)
50 auto a = (
recursor{ input[k] } | ... | std::get<i>(func) );
51 R.emplace_back(std::move(a.value));
55 std::for_each(std::execution::par,
62 template<
typename InputType,
typename... FuncTypes>
63 decltype(
auto)
operator|( std::vector<InputType>
const& input, std::tuple<FuncTypes...>
const& func )
65 using vector_t = std::vector<InputType>;
69 auto process = [&](
auto k)
74 auto a = (
recursor{ input[k] } | ... | std::get<i>(func) );
75 R.emplace_back(std::move(a.value));
79 std::for_each(std::execution::par,
87 template<
typename InputType, std::size_t N,
typename... FuncTypes>
88 decltype(
auto)
operator|( std::tuple<FuncTypes...>
const& func, std::array<InputType, N>
const& input )
90 using array_t = std::array<InputType, N>; array_t R;
92 auto process = [&](
auto k)
97 auto a = (
recursor{ input[k] } | ... | std::get<i>(func) );
98 R[k] = std::move(a.value);
102 std::for_each(std::execution::par,
109 template<
typename InputType, std::size_t N,
typename... FuncTypes>
110 decltype(
auto)
operator|( std::array<InputType, N>
const& input, std::tuple<FuncTypes...>
const& func )
112 using array_t = std::array<InputType, N>; array_t R;
114 auto process = [&](
auto k)
119 auto a = (
recursor{ input[k] } | ... | std::get<i>(func) );
120 R[k] = std::move(a.value);
124 std::for_each(std::execution::par,
132 template<cgt::tuple_flat_c TupleType,
typename FuncType>
136 return std::apply(std::forward<FuncType>(func),
137 std::forward<TupleType>(args));
140 template<cgt::std_array_flat_c ArrayType,
typename FuncType>
144 return std::apply(std::forward<FuncType>(func),
145 std::forward<ArrayType>(args));
148 template<cgt::span_flat_c SpanType,
typename FuncType>
152 return std::apply(std::forward<FuncType>(func),
153 std::forward<SpanType>(args));
156 template<
typename... ArgTypes,
typename... FuncTypes>
157 constexpr auto operator >>
158 (std::tuple<ArgTypes...>
const& args, std::tuple<FuncTypes...>
const& func)
163 return std::tuple{
std::apply(std::get<i>(func), args)...};
167 template<
typename ArgType, std::size_t N,
typename... FuncTypes>
168 constexpr auto operator >>
169 (std::array<ArgType, N>
const& args, std::tuple<FuncTypes...>
const& func)
174 return std::tuple{
std::apply(std::get<i>(func), args)...};
std::vector< Type > vector_t
constexpr auto operator>>(TupleType &&args, FuncType &&func)
constexpr decltype(auto) for_stallion(WorkType &&work, std::integer_sequence< T, Indices... >, ArgTypes &&... args)
std::integer_sequence< std::common_type_t< std::remove_cvref_t< decltype(Indices)>... >, Indices... > sequence
constexpr decltype(auto) apply(F &&f, T(&&c_array)[N])
recursor & operator|(FuncType &&func)