Skip to content

Commit

Permalink
Use decltype(auto) for the other then overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
aurianer committed Mar 31, 2020
1 parent 53b9684 commit 88918fd
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions hpx/lcos/future.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,24 +949,15 @@ namespace hpx { namespace lcos
using base_type::has_exception;

template <typename F>
typename util::lazy_enable_if<
hpx::traits::is_invocable<F, future&&>::value,
hpx::traits::future_then_result<future, F>
>::type
then(F && f, error_code& ec = throws)
decltype(auto) then(F && f, error_code& ec = throws)
{
invalidate on_exit(*this);
return base_type::then(std::move(*this),
std::forward<F>(f), ec);
}

template <typename T0, typename F>
typename util::lazy_enable_if<
!hpx::traits::is_invocable<T0, future&&>::value &&
hpx::traits::is_invocable<F, future&&>::value,
hpx::traits::future_then_result<future, F>
>::type
then(T0 && t0, F && f, error_code& ec = throws)
decltype(auto) then(T0 && t0, F && f, error_code& ec = throws)
{
invalidate on_exit(*this);
return base_type::then(std::move(*this),
Expand Down Expand Up @@ -1249,22 +1240,14 @@ namespace hpx { namespace lcos
using base_type::has_exception;

template <typename F>
typename util::lazy_enable_if<
hpx::traits::is_invocable<F, shared_future&&>::value,
hpx::traits::future_then_result<shared_future, F>
>::type
then(F && f, error_code& ec = throws) const
decltype(auto) then(F && f, error_code& ec = throws) const
{
return base_type::then(shared_future(*this),
std::forward<F>(f), ec);
}

template <typename T0, typename F>
typename util::lazy_enable_if<
!hpx::traits::is_invocable<T0, shared_future&&>::value,
hpx::traits::future_then_result<shared_future, F>
>::type
then(T0 && t0, F && f, error_code& ec = throws) const
decltype(auto) then(T0 && t0, F && f, error_code& ec = throws) const
{
return base_type::then(shared_future(*this),
std::forward<T0>(t0), std::forward<F>(f), ec);
Expand Down

0 comments on commit 88918fd

Please sign in to comment.