Commit 58d9eab5 authored by Eric Niebler's avatar Eric Niebler Committed by Facebook Github Bot

reduce needless out_from_fn instantiations

fbshipit-source-id: 7df1094b2072726b2d0fe8fb75693b4aff93cda2
parent d6f75f2e
...@@ -5851,29 +5851,27 @@ constexpr decltype(auto) apply(F&& f, Tuple&& t) { ...@@ -5851,29 +5851,27 @@ constexpr decltype(auto) apply(F&& f, Tuple&& t) {
namespace detail { namespace detail {
template <class... TagN> template <class Cardinality, bool IsFlow = false>
struct make_receiver; struct make_receiver;
template <> template <>
struct make_receiver<is_none<>, void> : construct_deduced<none> {}; struct make_receiver<is_none<>> : construct_deduced<none> {};
template <> template <>
struct make_receiver<is_single<>, void> : construct_deduced<single> {}; struct make_receiver<is_single<>> : construct_deduced<single> {};
template <> template <>
struct make_receiver<is_many<>, void> : construct_deduced<many> {}; struct make_receiver<is_many<>> : construct_deduced<many> {};
template <> template <>
struct make_receiver<is_single<>, is_flow<>> : construct_deduced<flow_single> {}; struct make_receiver<is_single<>, true> : construct_deduced<flow_single> {};
template <PUSHMI_TYPE_CONSTRAINT(Sender) In> template <class Cardinality, bool IsFlow>
struct out_from_fn { struct out_from_impl {
using Cardinality = property_set_index_t<properties_t<In>, is_silent<>>; using Make = make_receiver<Cardinality, IsFlow>;
using Flow = std::conditional_t<property_query_v<properties_t<In>, is_flow<>>, is_flow<>, void>;
using Make = make_receiver<Cardinality, Flow>;
PUSHMI_TEMPLATE (class... Ts) PUSHMI_TEMPLATE (class... Ts)
(requires Invocable<Make, Ts...>) (requires Invocable<Make, Ts...>)
auto operator()(std::tuple<Ts...> args) const { auto operator()(std::tuple<Ts...> args) const {
return pushmi::apply(Make(), std::move(args)); return pushmi::apply(Make(), std::move(args));
} }
PUSHMI_TEMPLATE (class... Ts, class... Fns, PUSHMI_TEMPLATE (class... Ts, class... Fns,
class This = std::enable_if_t<sizeof...(Fns) != 0, out_from_fn>) class This = std::enable_if_t<sizeof...(Fns) != 0, out_from_impl>)
(requires And<SemiMovable<Fns>...> && (requires And<SemiMovable<Fns>...> &&
Invocable<Make, std::tuple<Ts...>> && Invocable<Make, std::tuple<Ts...>> &&
Invocable<This, pushmi::invoke_result_t<Make, std::tuple<Ts...>>, Fns...>) Invocable<This, pushmi::invoke_result_t<Make, std::tuple<Ts...>>, Fns...>)
...@@ -5887,6 +5885,12 @@ struct out_from_fn { ...@@ -5887,6 +5885,12 @@ struct out_from_fn {
} }
}; };
template <PUSHMI_TYPE_CONSTRAINT(Sender) In>
using out_from_fn =
out_from_impl<
property_set_index_t<properties_t<In>, is_silent<>>,
property_query_v<properties_t<In>, is_flow<>>>;
template <class In, class FN> template <class In, class FN>
struct submit_transform_out_1 { struct submit_transform_out_1 {
FN fn_; FN fn_;
...@@ -6196,10 +6200,7 @@ using receiver_type_t = ...@@ -6196,10 +6200,7 @@ using receiver_type_t =
pushmi::invoke_result_t< pushmi::invoke_result_t<
pushmi::detail::make_receiver< pushmi::detail::make_receiver<
property_set_index_t<properties_t<In>, is_silent<>>, property_set_index_t<properties_t<In>, is_silent<>>,
std::conditional_t< property_query_v<properties_t<In>, is_flow<>>>,
property_query_v<properties_t<In>, is_flow<>>,
is_flow<>,
void>>,
AN...>; AN...>;
PUSHMI_CONCEPT_DEF( PUSHMI_CONCEPT_DEF(
......
...@@ -48,29 +48,27 @@ constexpr decltype(auto) apply(F&& f, Tuple&& t) { ...@@ -48,29 +48,27 @@ constexpr decltype(auto) apply(F&& f, Tuple&& t) {
namespace detail { namespace detail {
template <class... TagN> template <class Cardinality, bool IsFlow = false>
struct make_receiver; struct make_receiver;
template <> template <>
struct make_receiver<is_none<>, void> : construct_deduced<none> {}; struct make_receiver<is_none<>> : construct_deduced<none> {};
template <> template <>
struct make_receiver<is_single<>, void> : construct_deduced<single> {}; struct make_receiver<is_single<>> : construct_deduced<single> {};
template <> template <>
struct make_receiver<is_many<>, void> : construct_deduced<many> {}; struct make_receiver<is_many<>> : construct_deduced<many> {};
template <> template <>
struct make_receiver<is_single<>, is_flow<>> : construct_deduced<flow_single> {}; struct make_receiver<is_single<>, true> : construct_deduced<flow_single> {};
template <PUSHMI_TYPE_CONSTRAINT(Sender) In> template <class Cardinality, bool IsFlow>
struct out_from_fn { struct out_from_impl {
using Cardinality = property_set_index_t<properties_t<In>, is_silent<>>; using Make = make_receiver<Cardinality, IsFlow>;
using Flow = std::conditional_t<property_query_v<properties_t<In>, is_flow<>>, is_flow<>, void>;
using Make = make_receiver<Cardinality, Flow>;
PUSHMI_TEMPLATE (class... Ts) PUSHMI_TEMPLATE (class... Ts)
(requires Invocable<Make, Ts...>) (requires Invocable<Make, Ts...>)
auto operator()(std::tuple<Ts...> args) const { auto operator()(std::tuple<Ts...> args) const {
return pushmi::apply(Make(), std::move(args)); return pushmi::apply(Make(), std::move(args));
} }
PUSHMI_TEMPLATE (class... Ts, class... Fns, PUSHMI_TEMPLATE (class... Ts, class... Fns,
class This = std::enable_if_t<sizeof...(Fns) != 0, out_from_fn>) class This = std::enable_if_t<sizeof...(Fns) != 0, out_from_impl>)
(requires And<SemiMovable<Fns>...> && (requires And<SemiMovable<Fns>...> &&
Invocable<Make, std::tuple<Ts...>> && Invocable<Make, std::tuple<Ts...>> &&
Invocable<This, pushmi::invoke_result_t<Make, std::tuple<Ts...>>, Fns...>) Invocable<This, pushmi::invoke_result_t<Make, std::tuple<Ts...>>, Fns...>)
...@@ -84,6 +82,12 @@ struct out_from_fn { ...@@ -84,6 +82,12 @@ struct out_from_fn {
} }
}; };
template <PUSHMI_TYPE_CONSTRAINT(Sender) In>
using out_from_fn =
out_from_impl<
property_set_index_t<properties_t<In>, is_silent<>>,
property_query_v<properties_t<In>, is_flow<>>>;
template <class In, class FN> template <class In, class FN>
struct submit_transform_out_1 { struct submit_transform_out_1 {
FN fn_; FN fn_;
......
...@@ -22,10 +22,7 @@ using receiver_type_t = ...@@ -22,10 +22,7 @@ using receiver_type_t =
pushmi::invoke_result_t< pushmi::invoke_result_t<
pushmi::detail::make_receiver< pushmi::detail::make_receiver<
property_set_index_t<properties_t<In>, is_silent<>>, property_set_index_t<properties_t<In>, is_silent<>>,
std::conditional_t< property_query_v<properties_t<In>, is_flow<>>>,
property_query_v<properties_t<In>, is_flow<>>,
is_flow<>,
void>>,
AN...>; AN...>;
PUSHMI_CONCEPT_DEF( PUSHMI_CONCEPT_DEF(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment