Skip to content

Commit

Permalink
Add documentation to invoke_fused and friends NFC
Browse files Browse the repository at this point in the history
* Clearify the meaning of `invoke_fused` through
  using `invoke_fused_r` instead of the internal implementation.
  • Loading branch information
Naios committed May 6, 2017
1 parent 25bd011 commit 26f545d
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions hpx/util/invoke_fused.hpp
Expand Up @@ -68,26 +68,36 @@ namespace hpx { namespace util
}
}

template <typename F, typename Tuple>
/// \copydoc invoke_fused
///
/// \tparam R The result type of the function when it's called
/// with the content of the given sequenced type.
template <typename R, typename F, typename Tuple>
HPX_HOST_DEVICE HPX_FORCEINLINE
typename detail::fused_result_of<F&&(Tuple&&)>::type
invoke_fused(F&& f, Tuple&& t)
R invoke_fused_r(F&& f, Tuple&& t)
{
typedef typename detail::fused_result_of<F&&(Tuple&&)>::type R;

return detail::invoke_fused_impl<R>(
std::forward<F>(f), std::forward<Tuple>(t),
typename detail::fused_index_pack<Tuple>::type());
}

template <typename R, typename F, typename Tuple>
/// Invokes the given functional type f with the content of
/// the sequenced type t (tuples, pairs)
///
/// \returns The result of the function when it's called with
/// the content of the given sequenced type.
///
/// \note This is function is similar to `std::apply` (C++17)
template <typename F, typename Tuple>
HPX_HOST_DEVICE HPX_FORCEINLINE
R invoke_fused_r(F&& f, Tuple&& t)
typename detail::fused_result_of<F&&(Tuple&&)>::type
invoke_fused(F&& f, Tuple&& t)
{
return detail::invoke_fused_impl<R>(
std::forward<F>(f), std::forward<Tuple>(t),
typename detail::fused_index_pack<Tuple>::type());
typedef typename detail::fused_result_of<F&&(Tuple&&)>::type R;

return invoke_fused_r<R>(std::forward<F>(f), std::forward<Tuple>(t));
}

///////////////////////////////////////////////////////////////////////////
namespace functional
{
Expand Down

0 comments on commit 26f545d

Please sign in to comment.