Skip to content

Commit

Permalink
Add documentation to invoke_fused and invoke
Browse files Browse the repository at this point in the history
  • Loading branch information
Naios committed May 21, 2017
1 parent 88a829c commit 272dba4
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/CMakeLists.txt
Expand Up @@ -171,6 +171,8 @@ set(doxygen_dependencies
"${PROJECT_SOURCE_DIR}/hpx/lcos/when_some.hpp"
"${PROJECT_SOURCE_DIR}/hpx/lcos/wait_each.hpp"
"${PROJECT_SOURCE_DIR}/hpx/lcos/when_each.hpp"
"${PROJECT_SOURCE_DIR}/hpx/util/invoke.hpp"
"${PROJECT_SOURCE_DIR}/hpx/util/invoke_fused.hpp"
"${PROJECT_SOURCE_DIR}/hpx/performance_counters/manage_counter_type.hpp")


Expand Down
8 changes: 8 additions & 0 deletions docs/hpx.idx
Expand Up @@ -511,6 +511,14 @@ when_each_n "" "header\.hpx\.lcos\.when_each.*"
wait_each "" "header\.hpx\.lcos\.wait_each.*"
wait_each_n "" "header\.hpx\.lcos\.wait_each.*"

# hpx/util/invoke.hpp
invoke "" "header\.hpx\.util\.invoke.*"
invoke_r "" "header\.hpx\.util\.invoke_r.*"

# hpx/util/invoke_fused.hpp
invoke_fused "" "header\.hpx\.util\.invoke_fused.*"
invoke_fused_r "" "header\.hpx\.util\.invoke_fused_r.*"

# hpx/hpx_finalize.hpp
finalize "" "hpx\.finalize.*"
terminate "" "hpx\.terminate.*"
Expand Down
23 changes: 23 additions & 0 deletions hpx/util/invoke.hpp
Expand Up @@ -127,6 +127,23 @@ namespace hpx { namespace util
};
}

/// Invokes the given functional type f with the content of
/// the argument pack vs
///
/// \param f A functional type providing an `operator()`
/// or function pointer. If f is a member function pointer,
/// the first argument in the pack will be treated as
/// the callee (this object).
///
/// \param vs An arbitrary pack of arguments
///
/// \returns The result of the function when it's called with
/// the given argument types.
///
/// \throws std::exception thrown from a function
/// invocation of f with the argument types vs.
///
/// \note This is function is similar to `std::invoke` (C++17)
template <typename F, typename ...Ts>
HPX_HOST_DEVICE HPX_FORCEINLINE
typename util::result_of<F&&(Ts&&...)>::type
Expand All @@ -138,6 +155,10 @@ namespace hpx { namespace util
std::forward<F>(f), std::forward<Ts>(vs)...);
}

/// \copydoc invoke
///
/// \tparam R The result type of the function when it's called
/// with the content of the given argument types vs.
template <typename R, typename F, typename ...Ts>
HPX_HOST_DEVICE HPX_FORCEINLINE
R invoke_r(F&& f, Ts&&... vs)
Expand All @@ -147,6 +168,7 @@ namespace hpx { namespace util
}

///////////////////////////////////////////////////////////////////////////
/// \cond NOINTERNAL
namespace functional
{
struct invoke
Expand Down Expand Up @@ -175,6 +197,7 @@ namespace hpx { namespace util
}
};
}
/// \endcond
}}

#endif
25 changes: 25 additions & 0 deletions hpx/util/invoke_fused.hpp
Expand Up @@ -68,6 +68,25 @@ namespace hpx { namespace util
}
}

/// Invokes the given functional type f with the content of
/// the sequenced type t (tuples, pairs)
///
/// \param f A functional type providing an `operator()`
/// or function pointer. If f is a member function pointer,
/// the first argument in the sequenced type will be treated as
/// the callee (this object).
///
/// \param t A type which is content accessible through a call
/// to hpx#util#get.
///
/// \returns The result of the function when it's called with
/// the content of the given sequenced type.
///
/// \throws std::exception thrown from a function
/// invocation of f with the arguments contained
/// in the sequenceable type t.
///
/// \note This is function is similar to `std::apply` (C++17)
template <typename F, typename Tuple>
HPX_HOST_DEVICE HPX_FORCEINLINE
typename detail::fused_result_of<F&&(Tuple&&)>::type
Expand All @@ -80,6 +99,10 @@ namespace hpx { namespace util
typename detail::fused_index_pack<Tuple>::type());
}

/// \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
R invoke_fused_r(F&& f, Tuple&& t)
Expand All @@ -89,6 +112,7 @@ namespace hpx { namespace util
typename detail::fused_index_pack<Tuple>::type());
}
///////////////////////////////////////////////////////////////////////////
/// \cond NOINTERNAL
namespace functional
{
struct invoke_fused
Expand Down Expand Up @@ -119,6 +143,7 @@ namespace hpx { namespace util
}
};
}
/// \endcond
}}

#endif

0 comments on commit 272dba4

Please sign in to comment.