Commit 44febf20 authored by Kirk Shoop's avatar Kirk Shoop Committed by Facebook Github Bot

add customizatinos for nullary function to be a receiver (#54)

fbshipit-source-id: 113888cb7117615cb7c21ddaa6829805474fdd69
parent 8d2c3121
......@@ -23,13 +23,13 @@ set(header_files
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/detail/if_constexpr.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/detail/concept_def.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/traits.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/detail/functional.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/traits.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/detail/opt.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/forwards.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/entangle.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/extension_points.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/properties.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/extension_points.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/concepts.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/boosters.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/pushmi/piping.h"
......
This diff is collapsed.
......@@ -35,9 +35,6 @@ struct construct_deduced<receiver>;
template<>
struct construct_deduced<flow_receiver>;
template<>
struct construct_deduced<sender>;
template<>
struct construct_deduced<single_sender>;
......
......@@ -8,6 +8,7 @@
#include <functional>
#include "traits.h"
#include "properties.h"
namespace pushmi {
namespace __adl {
......@@ -124,6 +125,25 @@ void submit(SD& sd, TP tp, Out out)
sd->submit(std::move(tp), std::move(out));
}
//
// support a nullary function as a receiver
//
PUSHMI_TEMPLATE (class S)
(requires Invocable<S&>)
void set_done(S& s) noexcept {
}
PUSHMI_TEMPLATE (class S, class E)
(requires Invocable<S&>)
void set_error(S& s, E&& e) noexcept {
std::abort();
}
PUSHMI_TEMPLATE (class S)
(requires Invocable<S&>)
void set_value(S& s) noexcept(noexcept(s())) {
s();
}
//
// add support for std::promise externally
//
......@@ -328,6 +348,11 @@ PUSHMI_INLINE_VAR constexpr __adl::do_submit_fn submit{};
PUSHMI_INLINE_VAR constexpr __adl::get_top_fn now{};
PUSHMI_INLINE_VAR constexpr __adl::get_top_fn top{};
template<class T>
struct property_set_traits<T, std::enable_if_t<(bool)Invocable<T&> && not Valid<T&, __properties_t>>> {
using properties = property_set<is_receiver<>>;
};
template <class T>
struct property_set_traits<std::promise<T>> {
using properties = property_set<is_receiver<>>;
......
......@@ -300,6 +300,13 @@ class flow_receiver<>
: public flow_receiver<ignoreVF, abortEF, ignoreDF, ignoreStrtF> {
};
PUSHMI_CONCEPT_DEF(
template (class T)
concept FlowReceiverDataArg,
Receiver<T, is_flow<>> &&
not Invocable<T&>
);
// TODO winnow down the number of make_flow_receiver overloads and deduction
// guides here, as was done for make_many.
......@@ -313,7 +320,7 @@ PUSHMI_INLINE_VAR constexpr struct make_flow_receiver_fn {
(requires PUSHMI_EXP(
lazy::True<>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Receiver<VF>)))
not lazy::FlowReceiverDataArg<VF>)))
auto operator()(VF nf) const {
return flow_receiver<VF, abortEF, ignoreDF, ignoreStrtF>{
std::move(nf)};
......@@ -332,7 +339,7 @@ PUSHMI_INLINE_VAR constexpr struct make_flow_receiver_fn {
(requires PUSHMI_EXP(
lazy::True<>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Receiver<VF> PUSHMI_AND
not lazy::FlowReceiverDataArg<VF> PUSHMI_AND
not lazy::Invocable<EF&>)))
auto operator()(VF nf, EF ef) const {
return flow_receiver<VF, EF, ignoreDF, ignoreStrtF>{std::move(nf),
......@@ -343,7 +350,7 @@ PUSHMI_INLINE_VAR constexpr struct make_flow_receiver_fn {
lazy::True<> PUSHMI_AND
lazy::Invocable<DF&>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Receiver<EF>)))
not lazy::FlowReceiverDataArg<EF>)))
auto operator()(EF ef, DF df) const {
return flow_receiver<ignoreVF, EF, DF, ignoreStrtF>{std::move(ef), std::move(df)};
}
......@@ -351,7 +358,7 @@ PUSHMI_INLINE_VAR constexpr struct make_flow_receiver_fn {
(requires PUSHMI_EXP(
lazy::Invocable<DF&>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Receiver<VF>)))
not lazy::FlowReceiverDataArg<VF>)))
auto operator()(VF nf, EF ef, DF df) const {
return flow_receiver<VF, EF, DF, ignoreStrtF>{std::move(nf),
std::move(ef), std::move(df)};
......@@ -360,7 +367,7 @@ PUSHMI_INLINE_VAR constexpr struct make_flow_receiver_fn {
(requires PUSHMI_EXP(
lazy::Invocable<DF&>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Receiver<VF>)))
not lazy::FlowReceiverDataArg<VF>)))
auto operator()(VF nf, EF ef, DF df, StrtF strtf) const {
return flow_receiver<VF, EF, DF, StrtF>{std::move(nf), std::move(ef),
std::move(df), std::move(strtf)};
......@@ -368,7 +375,7 @@ PUSHMI_INLINE_VAR constexpr struct make_flow_receiver_fn {
PUSHMI_TEMPLATE(class Data)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::FlowReceiverDataArg<Data>))
auto operator()(Data d) const {
return flow_receiver<Data, passDVF, passDEF, passDDF, passDStrtF>{
std::move(d)};
......@@ -376,28 +383,28 @@ PUSHMI_INLINE_VAR constexpr struct make_flow_receiver_fn {
PUSHMI_TEMPLATE(class Data, class DVF)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::FlowReceiverDataArg<Data>))
auto operator()(Data d, DVF nf) const {
return flow_receiver<Data, DVF, passDEF, passDDF, passDStrtF>{
std::move(d), std::move(nf)};
}
PUSHMI_TEMPLATE(class Data, class... DEFN)
(requires PUSHMI_EXP(
lazy::Receiver<Data>))
lazy::FlowReceiverDataArg<Data>))
auto operator()(Data d, on_error_fn<DEFN...> ef) const {
return flow_receiver<Data, passDVF, on_error_fn<DEFN...>, passDDF, passDStrtF>{
std::move(d), std::move(ef)};
}
PUSHMI_TEMPLATE(class Data, class... DDFN)
(requires PUSHMI_EXP(
lazy::Receiver<Data>))
lazy::FlowReceiverDataArg<Data>))
auto operator()(Data d, on_done_fn<DDFN...> df) const {
return flow_receiver<Data, passDVF, passDEF, on_done_fn<DDFN...>, passDStrtF>{
std::move(d), std::move(df)};
}
PUSHMI_TEMPLATE(class Data, class DVF, class DEF)
(requires PUSHMI_EXP(
lazy::Receiver<Data>
lazy::FlowReceiverDataArg<Data>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Invocable<DEF&, Data&>)))
auto operator()(Data d, DVF nf, DEF ef) const {
......@@ -405,7 +412,7 @@ PUSHMI_INLINE_VAR constexpr struct make_flow_receiver_fn {
}
PUSHMI_TEMPLATE(class Data, class DEF, class DDF)
(requires PUSHMI_EXP(
lazy::Receiver<Data> PUSHMI_AND
lazy::FlowReceiverDataArg<Data> PUSHMI_AND
lazy::Invocable<DDF&, Data&>))
auto operator()(Data d, DEF ef, DDF df) const {
return flow_receiver<Data, passDVF, DEF, DDF, passDStrtF>{
......@@ -413,7 +420,7 @@ PUSHMI_INLINE_VAR constexpr struct make_flow_receiver_fn {
}
PUSHMI_TEMPLATE(class Data, class DVF, class DEF, class DDF)
(requires PUSHMI_EXP(
lazy::Receiver<Data> PUSHMI_AND
lazy::FlowReceiverDataArg<Data> PUSHMI_AND
lazy::Invocable<DDF&, Data&>))
auto operator()(Data d, DVF nf, DEF ef, DDF df) const {
return flow_receiver<Data, DVF, DEF, DDF, passDStrtF>{std::move(d),
......@@ -421,7 +428,7 @@ PUSHMI_INLINE_VAR constexpr struct make_flow_receiver_fn {
}
PUSHMI_TEMPLATE(class Data, class DVF, class DEF, class DDF, class DStrtF)
(requires PUSHMI_EXP(
lazy::Receiver<Data> PUSHMI_AND
lazy::FlowReceiverDataArg<Data> PUSHMI_AND
lazy::Invocable<DDF&, Data&>))
auto operator()(Data d, DVF nf, DEF ef, DDF df, DStrtF strtf) const {
return flow_receiver<Data, DVF, DEF, DDF, DStrtF>{std::move(d),
......@@ -438,7 +445,7 @@ PUSHMI_TEMPLATE(class VF)
(requires PUSHMI_EXP(
lazy::True<>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Receiver<VF>)))
not lazy::FlowReceiverDataArg<VF>)))
flow_receiver(VF) ->
flow_receiver<VF, abortEF, ignoreDF, ignoreStrtF>;
......@@ -454,7 +461,7 @@ PUSHMI_TEMPLATE(class VF, class EF)
(requires PUSHMI_EXP(
lazy::True<>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Receiver<VF> PUSHMI_AND
not lazy::FlowReceiverDataArg<VF> PUSHMI_AND
not lazy::Invocable<EF&>)))
flow_receiver(VF, EF) ->
flow_receiver<VF, EF, ignoreDF, ignoreStrtF>;
......@@ -464,7 +471,7 @@ PUSHMI_TEMPLATE(class EF, class DF)
lazy::True<> PUSHMI_AND
lazy::Invocable<DF&>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Receiver<EF>)))
not lazy::FlowReceiverDataArg<EF>)))
flow_receiver(EF, DF) ->
flow_receiver<ignoreVF, EF, DF, ignoreStrtF>;
......@@ -472,7 +479,7 @@ PUSHMI_TEMPLATE(class VF, class EF, class DF)
(requires PUSHMI_EXP(
lazy::Invocable<DF&>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Receiver<VF>)))
not lazy::FlowReceiverDataArg<VF>)))
flow_receiver(VF, EF, DF) ->
flow_receiver<VF, EF, DF, ignoreStrtF>;
......@@ -480,47 +487,47 @@ PUSHMI_TEMPLATE(class VF, class EF, class DF, class StrtF)
(requires PUSHMI_EXP(
lazy::Invocable<DF&>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Receiver<VF>)))
not lazy::FlowReceiverDataArg<VF>)))
flow_receiver(VF, EF, DF, StrtF) ->
flow_receiver<VF, EF, DF, StrtF>;
PUSHMI_TEMPLATE(class Data)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::FlowReceiverDataArg<Data>))
flow_receiver(Data d) ->
flow_receiver<Data, passDVF, passDEF, passDDF, passDStrtF>;
PUSHMI_TEMPLATE(class Data, class DVF)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::FlowReceiverDataArg<Data>))
flow_receiver(Data d, DVF nf) ->
flow_receiver<Data, DVF, passDEF, passDDF, passDStrtF>;
PUSHMI_TEMPLATE(class Data, class... DEFN)
(requires PUSHMI_EXP(
lazy::Receiver<Data>))
lazy::FlowReceiverDataArg<Data>))
flow_receiver(Data d, on_error_fn<DEFN...>) ->
flow_receiver<Data, passDVF, on_error_fn<DEFN...>, passDDF, passDStrtF>;
PUSHMI_TEMPLATE(class Data, class... DDFN)
(requires PUSHMI_EXP(
lazy::Receiver<Data>))
lazy::FlowReceiverDataArg<Data>))
flow_receiver(Data d, on_done_fn<DDFN...>) ->
flow_receiver<Data, passDVF, passDEF, on_done_fn<DDFN...>, passDStrtF>;
PUSHMI_TEMPLATE(class Data, class DDF)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data> PUSHMI_AND
lazy::FlowReceiverDataArg<Data> PUSHMI_AND
lazy::Invocable<DDF&, Data&>))
flow_receiver(Data d, DDF) ->
flow_receiver<Data, passDVF, passDEF, DDF, passDStrtF>;
PUSHMI_TEMPLATE(class Data, class DVF, class DEF)
(requires PUSHMI_EXP(
lazy::Receiver<Data>
lazy::FlowReceiverDataArg<Data>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Invocable<DEF&, Data&>)))
flow_receiver(Data d, DVF nf, DEF ef) ->
......@@ -528,21 +535,21 @@ flow_receiver(Data d, DVF nf, DEF ef) ->
PUSHMI_TEMPLATE(class Data, class DEF, class DDF)
(requires PUSHMI_EXP(
lazy::Receiver<Data> PUSHMI_AND
lazy::FlowReceiverDataArg<Data> PUSHMI_AND
lazy::Invocable<DDF&, Data&>))
flow_receiver(Data d, DEF, DDF) ->
flow_receiver<Data, passDVF, DEF, DDF, passDStrtF>;
PUSHMI_TEMPLATE(class Data, class DVF, class DEF, class DDF)
(requires PUSHMI_EXP(
lazy::Receiver<Data> PUSHMI_AND
lazy::FlowReceiverDataArg<Data> PUSHMI_AND
lazy::Invocable<DDF&, Data&>))
flow_receiver(Data d, DVF nf, DEF ef, DDF df) ->
flow_receiver<Data, DVF, DEF, DDF, passDStrtF>;
PUSHMI_TEMPLATE(class Data, class DVF, class DEF, class DDF, class DStrtF)
(requires PUSHMI_EXP(
lazy::Receiver<Data> PUSHMI_AND
lazy::FlowReceiverDataArg<Data> PUSHMI_AND
lazy::Invocable<DDF&, Data&> ))
flow_receiver(Data d, DVF nf, DEF ef, DDF df, DStrtF strtf) ->
flow_receiver<Data, DVF, DEF, DDF, DStrtF>;
......
......@@ -15,7 +15,7 @@ namespace pushmi {
template <class T, class = void>
struct property_traits;
template <class T>
template <class T, class = void>
struct property_set_traits;
template<class... PropertyN>
......@@ -67,9 +67,6 @@ class receiver;
template <PUSHMI_TYPE_CONSTRAINT(SemiMovable)... TN>
class flow_receiver;
template <PUSHMI_TYPE_CONSTRAINT(SemiMovable)... TN>
class sender;
template <PUSHMI_TYPE_CONSTRAINT(SemiMovable)... TN>
class single_sender;
......
......@@ -61,6 +61,8 @@ struct make_receiver<is_many<>, true> : construct_deduced<flow_receiver> {};
template <class Cardinality, bool IsFlow>
struct receiver_from_impl {
using MakeReceiver = make_receiver<Cardinality, IsFlow>;
template<class... AN>
using receiver_type = pushmi::invoke_result_t<MakeReceiver&, AN...>;
PUSHMI_TEMPLATE (class... Ts)
(requires Invocable<MakeReceiver, Ts...>)
auto operator()(std::tuple<Ts...> args) const {
......@@ -87,6 +89,10 @@ using receiver_from_fn =
property_set_index_t<properties_t<In>, is_single<>>,
property_query_v<properties_t<In>, is_flow<>>>;
template <PUSHMI_TYPE_CONSTRAINT(Sender) In, class... AN>
using receiver_type_t =
typename receiver_from_fn<In>::template receiver_type<AN...>;
template <class In, class FN>
struct submit_transform_out_1 {
FN fn_;
......
......@@ -17,13 +17,6 @@
namespace pushmi {
namespace detail {
namespace submit_detail {
template <PUSHMI_TYPE_CONSTRAINT(Sender) In, class ...AN>
using receiver_type_t =
pushmi::invoke_result_t<
pushmi::detail::make_receiver<
property_set_index_t<properties_t<In>, is_single<>>,
property_query_v<properties_t<In>, is_flow<>>>,
AN...>;
PUSHMI_CONCEPT_DEF(
template (class In, class ... AN)
......@@ -52,11 +45,10 @@ private:
std::tuple<AN...> args_;
PUSHMI_TEMPLATE(class In)
(requires
submit_detail::AutoSenderTo<In, AN...> &&
Invocable<::pushmi::detail::receiver_from_fn<In>&, std::tuple<AN...>>
submit_detail::AutoSenderTo<In, AN...>
)
In operator()(In in) {
auto out{::pushmi::detail::receiver_from_fn<In>()(std::move(args_))};
auto out{::pushmi::detail::receiver_from_fn<In>{}(std::move(args_))};
::pushmi::submit(in, std::move(out));
return in;
}
......
......@@ -16,17 +16,13 @@ namespace pushmi {
template <class T>
using __property_category_t = typename T::property_category;
// allow specializations to use enable_if to constrain
template <class T, class>
struct property_traits : property_traits<std::decay_t<T>> {
};
template <class T>
struct property_traits<T,
std::enable_if_t<Decayed<T> && not Valid<T, __property_category_t>>> {
};
struct property_traits {};
template <class T>
struct property_traits<T,
std::enable_if_t<Decayed<T> && Valid<T, __property_category_t>>> {
using property_category = __property_category_t<T>;
std::enable_if_t<Valid<std::decay_t<T>, __property_category_t>>> {
using property_category = __property_category_t<std::decay_t<T>>;
};
template <class T>
......@@ -56,7 +52,7 @@ PUSHMI_CONCEPT_DEF(
namespace detail {
template <PUSHMI_TYPE_CONSTRAINT(Property) P, class = property_category_t<P>>
struct property_set_element {};
}
} // namespace detail
template<class... PropertyN>
struct property_set : detail::property_set_element<PropertyN>... {
......@@ -76,23 +72,13 @@ PUSHMI_CONCEPT_DEF(
template <class T>
using __properties_t = typename T::properties;
namespace detail {
template <class T, class = void>
struct property_set_traits_impl : property_traits<std::decay_t<T>> {
};
template <class T>
struct property_set_traits_impl<T,
std::enable_if_t<Decayed<T> && not Valid<T, __properties_t>>> {
};
template <class T>
struct property_set_traits_impl<T,
std::enable_if_t<Decayed<T> && Valid<T, __properties_t>>> {
using properties = __properties_t<T>;
};
} // namespace detail
// allow specializations to use enable_if to constrain
template <class T, class>
struct property_set_traits {};
template <class T>
struct property_set_traits : detail::property_set_traits_impl<T> {
struct property_set_traits<T,
std::enable_if_t<Valid<std::decay_t<T>, __properties_t>>> {
using properties = __properties_t<std::decay_t<T>>;
};
template <class T>
......
......@@ -263,6 +263,13 @@ public:
receiver() = default;
};
PUSHMI_CONCEPT_DEF(
template (class T)
concept ReceiverDataArg,
Receiver<T> &&
not Invocable<T&>
);
////////////////////////////////////////////////////////////////////////////////
// make_receiver
PUSHMI_INLINE_VAR constexpr struct make_receiver_fn {
......@@ -272,7 +279,7 @@ PUSHMI_INLINE_VAR constexpr struct make_receiver_fn {
PUSHMI_TEMPLATE(class VF)
(requires PUSHMI_EXP(
lazy::True<>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND not lazy::Receiver<VF>)))
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND not lazy::ReceiverDataArg<VF>)))
auto operator()(VF vf) const {
return receiver<VF, abortEF, ignoreDF>{std::move(vf)};
}
......@@ -288,7 +295,7 @@ PUSHMI_INLINE_VAR constexpr struct make_receiver_fn {
(requires PUSHMI_EXP(
lazy::True<>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Receiver<VF> PUSHMI_AND
not lazy::ReceiverDataArg<VF> PUSHMI_AND
not lazy::Invocable<EF&>)))
auto operator()(VF vf, EF ef) const {
return receiver<VF, EF, ignoreDF>{std::move(vf), std::move(ef)};
......@@ -297,7 +304,7 @@ PUSHMI_INLINE_VAR constexpr struct make_receiver_fn {
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Invocable<DF&>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND not lazy::Receiver<EF>)))
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND not lazy::ReceiverDataArg<EF>)))
auto operator()(EF ef, DF df) const {
return receiver<ignoreVF, EF, DF>{std::move(ef), std::move(df)};
}
......@@ -305,56 +312,56 @@ PUSHMI_INLINE_VAR constexpr struct make_receiver_fn {
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Invocable<DF&>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND not lazy::Receiver<VF>)))
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND not lazy::ReceiverDataArg<VF>)))
auto operator()(VF vf, EF ef, DF df) const {
return receiver<VF, EF, DF>{std::move(vf), std::move(ef), std::move(df)};
}
PUSHMI_TEMPLATE(class Data)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::ReceiverDataArg<Data>))
auto operator()(Data d) const {
return receiver<Data, passDVF, passDEF, passDDF>{std::move(d)};
}
PUSHMI_TEMPLATE(class Data, class DVF)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::ReceiverDataArg<Data>))
auto operator()(Data d, DVF vf) const {
return receiver<Data, DVF, passDEF, passDDF>{std::move(d), std::move(vf)};
}
PUSHMI_TEMPLATE(class Data, class... DEFN)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::ReceiverDataArg<Data>))
auto operator()(Data d, on_error_fn<DEFN...> ef) const {
return receiver<Data, passDVF, on_error_fn<DEFN...>, passDDF>{std::move(d), std::move(ef)};
}
PUSHMI_TEMPLATE(class Data, class... DDFN)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::ReceiverDataArg<Data>))
auto operator()(Data d, on_done_fn<DDFN...> df) const {
return receiver<Data, passDVF, passDEF, on_done_fn<DDFN...>>{std::move(d), std::move(df)};
}
PUSHMI_TEMPLATE(class Data, class DVF, class... DEFN)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::ReceiverDataArg<Data>))
auto operator()(Data d, DVF vf, on_error_fn<DEFN...> ef) const {
return receiver<Data, DVF, on_error_fn<DEFN...>, passDDF>{std::move(d), std::move(vf), std::move(ef)};
}
PUSHMI_TEMPLATE(class Data, class DEF, class... DDFN)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::ReceiverDataArg<Data>))
auto operator()(Data d, DEF ef, on_done_fn<DDFN...> df) const {
return receiver<Data, passDVF, DEF, on_done_fn<DDFN...>>{std::move(d), std::move(ef), std::move(df)};
}
PUSHMI_TEMPLATE(class Data, class DVF, class DEF, class DDF)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data> PUSHMI_AND
lazy::ReceiverDataArg<Data> PUSHMI_AND
lazy::Invocable<DDF&, Data&>))
auto operator()(Data d, DVF vf, DEF ef, DDF df) const {
return receiver<Data, DVF, DEF, DDF>{std::move(d), std::move(vf), std::move(ef), std::move(df)};
......@@ -369,7 +376,6 @@ receiver() -> receiver<>;
PUSHMI_TEMPLATE(class VF)
(requires PUSHMI_EXP(
True<>
// lazy::Callable<VF>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND not lazy::Receiver<VF>)))
receiver(VF) -> receiver<VF, abortEF, ignoreDF>;
......@@ -383,7 +389,7 @@ PUSHMI_TEMPLATE(class VF, class EF)
(requires PUSHMI_EXP(
lazy::True<>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND
not lazy::Receiver<VF> PUSHMI_AND
not lazy::ReceiverDataArg<VF> PUSHMI_AND
not lazy::Invocable<EF&>)))
receiver(VF, EF) -> receiver<VF, EF, ignoreDF>;
......@@ -391,59 +397,59 @@ PUSHMI_TEMPLATE(class EF, class DF)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Invocable<DF&>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND not lazy::Receiver<EF>)))
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND not lazy::ReceiverDataArg<EF>)))
receiver(EF, DF) -> receiver<ignoreVF, EF, DF>;
PUSHMI_TEMPLATE(class VF, class EF, class DF)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Invocable<DF&>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND not lazy::Receiver<VF>)))
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND not lazy::ReceiverDataArg<VF>)))
receiver(VF, EF, DF) -> receiver<VF, EF, DF>;
PUSHMI_TEMPLATE(class Data)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::ReceiverDataArg<Data>))
receiver(Data d) -> receiver<Data, passDVF, passDEF, passDDF>;
PUSHMI_TEMPLATE(class Data, class DVF)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::ReceiverDataArg<Data>))
receiver(Data d, DVF vf) -> receiver<Data, DVF, passDEF, passDDF>;
PUSHMI_TEMPLATE(class Data, class... DEFN)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::ReceiverDataArg<Data>))
receiver(Data d, on_error_fn<DEFN...>) ->
receiver<Data, passDVF, on_error_fn<DEFN...>, passDDF>;
PUSHMI_TEMPLATE(class Data, class... DDFN)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::ReceiverDataArg<Data>))
receiver(Data d, on_done_fn<DDFN...>) ->
receiver<Data, passDVF, passDEF, on_done_fn<DDFN...>>;
PUSHMI_TEMPLATE(class Data, class DVF, class... DEFN)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>))
lazy::ReceiverDataArg<Data>))
receiver(Data d, DVF vf, on_error_fn<DEFN...> ef) -> receiver<Data, DVF, on_error_fn<DEFN...>, passDDF>;
PUSHMI_TEMPLATE(class Data, class DEF, class... DDFN)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data>
lazy::ReceiverDataArg<Data>
PUSHMI_BROKEN_SUBSUMPTION(PUSHMI_AND not lazy::Invocable<DEF&, Data&>)))
receiver(Data d, DEF, on_done_fn<DDFN...>) -> receiver<Data, passDVF, DEF, on_done_fn<DDFN...>>;
PUSHMI_TEMPLATE(class Data, class DVF, class DEF, class DDF)
(requires PUSHMI_EXP(
lazy::True<> PUSHMI_AND
lazy::Receiver<Data> PUSHMI_AND
lazy::ReceiverDataArg<Data>PUSHMI_AND
lazy::Invocable<DDF&, Data&>))
receiver(Data d, DVF vf, DEF ef, DDF df) -> receiver<Data, DVF, DEF, DDF>;
#endif
......
......@@ -7,7 +7,7 @@
#include <functional>
#include <type_traits>
#include "detail/concept_def.h"
#include "detail/functional.h"
#define PUSHMI_NOEXCEPT_AUTO(...) \
noexcept(noexcept(static_cast<decltype((__VA_ARGS__))>(__VA_ARGS__)))\
......
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