Commit 54a23fa3 authored by Kirk Shoop's avatar Kirk Shoop Committed by Facebook Github Bot

strengthen transform submit constraints

Summary: constrain transform submit on the validity of the underlying submit

Reviewed By: ericniebler

Differential Revision: D15104546

fbshipit-source-id: 7eea68074e4f9a4e51e77af55abf8c1b10e936af
parent 78c14b68
......@@ -51,19 +51,18 @@ struct transform_fn {
template <class F, class In>
struct submit_impl {
F f_;
using maker_t = receiver_from_fn<std::decay_t<In>>;
PUSHMI_TEMPLATE(class SIn, class Out)
(requires Receiver<Out> && Constructible<F, const F&>) //
auto operator()(SIn&& in, Out&& out) & {
(requires Receiver<Out> && Constructible<F, const F&> && SenderTo<In, invoke_result_t<maker_t, Out, value_fn<F>>>) //
void operator()(SIn&& in, Out&& out) & {
// copy 'f_' to allow multiple calls to connect to multiple 'in'
using maker_t = receiver_from_fn<std::decay_t<In>>;
::folly::pushmi::submit(
(In &&) in,
maker_t{}((Out &&) out, value_fn<F>{std::move(f_)}));
maker_t{}((Out &&) out, value_fn<F>{f_}));
}
PUSHMI_TEMPLATE(class SIn, class Out)
(requires Receiver<Out> && Constructible<F, F&&>) //
auto operator()(SIn&& in, Out&& out) && {
using maker_t = receiver_from_fn<std::decay_t<In>>;
(requires Receiver<Out> && MoveConstructible<F> && SenderTo<In, invoke_result_t<maker_t, Out, value_fn<F>>>) //
void operator()(SIn&& in, Out&& out) && {
::folly::pushmi::submit(
(In &&) in,
maker_t{}((Out &&) out, value_fn<F>{std::move(f_)}));
......
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