Commit 85207e0f authored by Eric Niebler's avatar Eric Niebler Committed by Facebook Github Bot

work around various gcc-6 and -7 bugs

fbshipit-source-id: a26e4e767b4aea27d5092edba3f755a02a8e1cbe
parent e1af1682
......@@ -920,7 +920,7 @@ PUSHMI_CONCEPT_DEF(
Semiregular<T> && EqualityComparable<T>
);
#if __cpp_lib_invoke >= 201411
#if 0 //__cpp_lib_invoke >= 201411
using std::invoke;
#else
PUSHMI_TEMPLATE (class F, class...As)
......@@ -5080,9 +5080,21 @@ struct out_from_fn {
};
PUSHMI_TEMPLATE(class In, class FN)
(requires Sender<In> && SemiMovable<FN>)
(requires Sender<In> && SemiMovable<FN>
PUSHMI_BROKEN_SUBSUMPTION(&& not TimeSender<In>))
auto submit_transform_out(FN fn){
return on_submit(
constrain(lazy::Receiver<_2>,
[fn = std::move(fn)](In& in, auto out) {
::pushmi::submit(in, fn(std::move(out)));
}
)
);
}
PUSHMI_TEMPLATE(class In, class FN)
(requires TimeSender<In> && SemiMovable<FN>)
auto submit_transform_out(FN fn){
PUSHMI_IF_CONSTEXPR_RETURN( ((bool) TimeSender<In>) (
return on_submit(
constrain(lazy::Receiver<_3>,
[fn = std::move(fn)](In& in, auto tp, auto out) {
......@@ -5090,21 +5102,24 @@ auto submit_transform_out(FN fn){
}
)
);
) else (
}
PUSHMI_TEMPLATE(class In, class SDSF, class TSDSF)
(requires Sender<In> && SemiMovable<SDSF> && SemiMovable<TSDSF>
PUSHMI_BROKEN_SUBSUMPTION(&& not TimeSender<In>))
auto submit_transform_out(SDSF sdsf, TSDSF tsdsf) {
return on_submit(
constrain(lazy::Receiver<_2>,
[fn = std::move(fn)](In& in, auto out) {
::pushmi::submit(in, fn(std::move(out)));
constrain(lazy::Receiver<_2> && lazy::Invocable<SDSF&, In&, _2>,
[sdsf = std::move(sdsf)](In& in, auto out) {
sdsf(in, std::move(out));
}
)
);
))
}
PUSHMI_TEMPLATE(class In, class SDSF, class TSDSF)
(requires Sender<In> && SemiMovable<SDSF> && SemiMovable<TSDSF>)
(requires TimeSender<In> && SemiMovable<SDSF> && SemiMovable<TSDSF>)
auto submit_transform_out(SDSF sdsf, TSDSF tsdsf) {
PUSHMI_IF_CONSTEXPR_RETURN( ((bool) TimeSender<In>) (
return on_submit(
constrain(lazy::Receiver<_3> && lazy::Invocable<TSDSF&, In&, _2, _3>,
[tsdsf = std::move(tsdsf)](In& in, auto tp, auto out) {
......@@ -5112,15 +5127,6 @@ auto submit_transform_out(SDSF sdsf, TSDSF tsdsf) {
}
)
);
) else (
return on_submit(
constrain(lazy::Receiver<_2> && lazy::Invocable<SDSF&, In&, _2>,
[sdsf = std::move(sdsf)](In& in, auto out) {
sdsf(in, std::move(out));
}
)
);
))
}
PUSHMI_TEMPLATE(class In, class Out)
......@@ -6020,6 +6026,10 @@ PUSHMI_INLINE_VAR constexpr struct make_tap_fn {
} const make_tap {};
struct tap_fn {
private:
template <class In, class SideEffects>
static auto impl(In, SideEffects);
public:
template <class... AN>
auto operator()(AN... an) const;
};
......@@ -6040,9 +6050,14 @@ auto tap_fn::operator()(AN... an) const {
return constrain(lazy::Sender<_1>,
[args = std::tuple<AN...>{std::move(an)...}](auto in) mutable {
using In = decltype(in);
auto sideEffects{::pushmi::detail::out_from_fn<In>()(std::move(args))};
using SideEffects = decltype(sideEffects);
return tap_fn::impl(
std::move(in),
::pushmi::detail::out_from_fn<In>()(std::move(args)));
});
}
template <class In, class SideEffects>
auto tap_fn::impl(In in, SideEffects sideEffects) {
PUSHMI_STATIC_ASSERT(
::pushmi::detail::deferred_requires_from<In, SideEffects,
SenderTo<In, SideEffects, is_none<>>,
......@@ -6076,8 +6091,6 @@ auto tap_fn::operator()(AN... an) const {
)
)
);
}
);
}
} // namespace detail
......
......@@ -81,9 +81,21 @@ struct out_from_fn {
};
PUSHMI_TEMPLATE(class In, class FN)
(requires Sender<In> && SemiMovable<FN>)
(requires Sender<In> && SemiMovable<FN>
PUSHMI_BROKEN_SUBSUMPTION(&& not TimeSender<In>))
auto submit_transform_out(FN fn){
return on_submit(
constrain(lazy::Receiver<_2>,
[fn = std::move(fn)](In& in, auto out) {
::pushmi::submit(in, fn(std::move(out)));
}
)
);
}
PUSHMI_TEMPLATE(class In, class FN)
(requires TimeSender<In> && SemiMovable<FN>)
auto submit_transform_out(FN fn){
PUSHMI_IF_CONSTEXPR_RETURN( ((bool) TimeSender<In>) (
return on_submit(
constrain(lazy::Receiver<_3>,
[fn = std::move(fn)](In& in, auto tp, auto out) {
......@@ -91,21 +103,24 @@ auto submit_transform_out(FN fn){
}
)
);
) else (
}
PUSHMI_TEMPLATE(class In, class SDSF, class TSDSF)
(requires Sender<In> && SemiMovable<SDSF> && SemiMovable<TSDSF>
PUSHMI_BROKEN_SUBSUMPTION(&& not TimeSender<In>))
auto submit_transform_out(SDSF sdsf, TSDSF tsdsf) {
return on_submit(
constrain(lazy::Receiver<_2>,
[fn = std::move(fn)](In& in, auto out) {
::pushmi::submit(in, fn(std::move(out)));
constrain(lazy::Receiver<_2> && lazy::Invocable<SDSF&, In&, _2>,
[sdsf = std::move(sdsf)](In& in, auto out) {
sdsf(in, std::move(out));
}
)
);
))
}
PUSHMI_TEMPLATE(class In, class SDSF, class TSDSF)
(requires Sender<In> && SemiMovable<SDSF> && SemiMovable<TSDSF>)
(requires TimeSender<In> && SemiMovable<SDSF> && SemiMovable<TSDSF>)
auto submit_transform_out(SDSF sdsf, TSDSF tsdsf) {
PUSHMI_IF_CONSTEXPR_RETURN( ((bool) TimeSender<In>) (
return on_submit(
constrain(lazy::Receiver<_3> && lazy::Invocable<TSDSF&, In&, _2, _3>,
[tsdsf = std::move(tsdsf)](In& in, auto tp, auto out) {
......@@ -113,15 +128,6 @@ auto submit_transform_out(SDSF sdsf, TSDSF tsdsf) {
}
)
);
) else (
return on_submit(
constrain(lazy::Receiver<_2> && lazy::Invocable<SDSF&, In&, _2>,
[sdsf = std::move(sdsf)](In& in, auto out) {
sdsf(in, std::move(out));
}
)
);
))
}
PUSHMI_TEMPLATE(class In, class Out)
......
......@@ -57,6 +57,10 @@ PUSHMI_INLINE_VAR constexpr struct make_tap_fn {
} const make_tap {};
struct tap_fn {
private:
template <class In, class SideEffects>
static auto impl(In, SideEffects);
public:
template <class... AN>
auto operator()(AN... an) const;
};
......@@ -77,9 +81,14 @@ auto tap_fn::operator()(AN... an) const {
return constrain(lazy::Sender<_1>,
[args = std::tuple<AN...>{std::move(an)...}](auto in) mutable {
using In = decltype(in);
auto sideEffects{::pushmi::detail::out_from_fn<In>()(std::move(args))};
using SideEffects = decltype(sideEffects);
return tap_fn::impl(
std::move(in),
::pushmi::detail::out_from_fn<In>()(std::move(args)));
});
}
template <class In, class SideEffects>
auto tap_fn::impl(In in, SideEffects sideEffects) {
PUSHMI_STATIC_ASSERT(
::pushmi::detail::deferred_requires_from<In, SideEffects,
SenderTo<In, SideEffects, is_none<>>,
......@@ -113,8 +122,6 @@ auto tap_fn::operator()(AN... an) const {
)
)
);
}
);
}
} // namespace detail
......
......@@ -192,7 +192,7 @@ PUSHMI_CONCEPT_DEF(
Semiregular<T> && EqualityComparable<T>
);
#if __cpp_lib_invoke >= 201411
#if 0 //__cpp_lib_invoke >= 201411
using std::invoke;
#else
PUSHMI_TEMPLATE (class F, class...As)
......
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