functional¶
The contents of this module can be included with the header
hpx/modules/functional.hpp
. These headers may be used by user-code but are not
guaranteed stable (neither header location nor contents). You are using these at
your own risk. If you wish to use non-public functionality from a module we
strongly suggest only including the module header hpx/modules/functional.hpp
, not
the particular header in which the functionality you would like to use is
defined. See Public API for a list of names that are part of the public
HPX API.
-
namespace
hpx
-
namespace
serialization
-
namespace
util
Functions
-
template<typename
F
, typename ...Ts
, typenameEnable
= typename std::enable_if<!traits::is_action<typename std::decay<F>::type>::value>::type>
constexpr detail::bound<typename std::decay<F>::type, typename util::make_index_pack<sizeof...(Ts)>::type, typename util::decay_unwrap<Ts>::type...>bind
(F &&f, Ts&&... vs)¶
-
namespace
placeholders
¶ Variables
-
constexpr detail::placeholder<1>
_1
= {}¶
-
constexpr detail::placeholder<2>
_2
= {}¶
-
constexpr detail::placeholder<3>
_3
= {}¶
-
constexpr detail::placeholder<4>
_4
= {}¶
-
constexpr detail::placeholder<5>
_5
= {}¶
-
constexpr detail::placeholder<6>
_6
= {}¶
-
constexpr detail::placeholder<7>
_7
= {}¶
-
constexpr detail::placeholder<8>
_8
= {}¶
-
constexpr detail::placeholder<9>
_9
= {}¶
-
constexpr detail::placeholder<1>
-
template<typename
-
namespace
-
namespace
hpx
-
namespace
serialization
-
namespace
util
-
namespace
-
namespace
hpx
-
namespace
serialization
-
namespace
util
-
namespace
-
namespace
hpx
-
namespace
serialization
-
namespace
util
-
namespace
Defines
-
HPX_UTIL_REGISTER_FUNCTION_DECLARATION
(Sig, F, Name)¶
-
HPX_UTIL_REGISTER_FUNCTION
(Sig, F, Name)¶
-
namespace
hpx
-
namespace
util
-
-
template<typename
R
, typename ...Ts
, boolSerializable
>
classfunction
<R(Ts...), Serializable> : public detail::basic_function<R(Ts...), true, Serializable>¶ Public Types
-
template<>
usingresult_type
= R¶
Public Functions
-
function &
operator=
(function const&)¶
-
function &
operator=
(function&&)¶
Private Types
-
template<>
usingbase_type
= detail::basic_function<R(Ts...), true, Serializable>¶
-
template<>
-
template<typename
-
namespace
-
namespace
hpx
-
namespace
util
-
template<typename
R
, typename ...Ts
>
classfunction_ref
<R(Ts...)>¶ Public Functions
-
template<typename
F
, typenameFD
= typename std::decay<F>::type, typenameEnable
= typename std::enable_if<!std::is_same<FD, function_ref>::value && is_invocable_r_v<R, F&, Ts...>>::type>function_ref
(F &&f)¶
-
function_ref
(function_ref const &other)¶
-
template<typename
F
, typenameFD
= typename std::decay<F>::type, typenameEnable
= typename std::enable_if<!std::is_same<FD, function_ref>::value && is_invocable_r_v<R, F&, Ts...>>::type>
function_ref &operator=
(F &&f)¶
-
function_ref &
operator=
(function_ref const &other)¶
-
template<typename
F
, typenameT
= typename std::remove_reference<F>::type, typenameEnable
= typename std::enable_if<!std::is_pointer<T>::value>::type>
voidassign
(F &&f)¶
-
void
swap
(function_ref &f)¶
-
R
operator()
(Ts... vs) const¶
-
char const *
get_function_annotation
() const¶
-
util::itt::string_handle
get_function_annotation_itt
() const¶
Private Types
-
template<>
usingVTable
= detail::function_ref_vtable<R(Ts...)>¶
Private Static Functions
-
template<typename
T
>
static VTable const *get_vtable
()¶
-
template<typename
-
template<typename
-
namespace
Defines
-
HPX_INVOKE_R
(R, F, ...)¶
-
namespace
hpx
-
namespace
util
Functions
-
template<typename
F
, typename ...Ts
>
constexpr util::invoke_result<F, Ts...>::typeinvoke
(F &&f, Ts&&... vs)¶ Invokes the given callable object f with the content of the argument pack vs
- Return
The result of the callable object when it’s called with the given argument types.
- Note
This function is similar to
std::invoke
(C++17)- Parameters
f
: Requires to be a callable object. If f is a member function pointer, the first argument in the pack will be treated as the callee (this object).vs
: An arbitrary pack of arguments
- Exceptions
std::exception
: like objects thrown by call to object f with the argument types vs.
-
template<typename
-
namespace
-
namespace
hpx
-
namespace
util
Functions
-
template<typename
F
, typenameTuple
>
constexpr detail::invoke_fused_result<F, Tuple>::typeinvoke_fused
(F &&f, Tuple &&t)¶ Invokes the given callable object f with the content of the sequenced type t (tuples, pairs)
- Return
The result of the callable object when it’s called with the content of the given sequenced type.
- Note
This function is similar to
std::apply
(C++17)- Parameters
f
: Must be a callable object. If f is a member function pointer, the first argument in the sequenced type will be treated as the callee (this object).t
: A type which is content accessible through a call to hpx::util::get.
- Exceptions
std::exception
: like objects thrown by call to object f with the arguments contained in the sequenceable type t.
-
template<typename
-
namespace
-
namespace
hpx
-
namespace
util
-
namespace
-
namespace
hpx
-
namespace
util
-
namespace
-
namespace
hpx
-
namespace
serialization
-
namespace
util
-
namespace
-
namespace
hpx
-
namespace
util
-
namespace
-
namespace
hpx
-
namespace
functional
¶ Typedefs
-
template<typename
Tag
, typename ...Args
>
usingtag_dispatch_result
= invoke_result<decltype(tag_dispatch), Tag, Args...>¶ hpx::functional::tag_dispatch_result<Tag, Args...>
is the trait returning the result type of the call hpx::functioanl::tag_dispatch. This can be used in a SFINAE context.
-
template<typename
Tag
, typename ...Args
>
usingtag_dispatch_result_t
= typename tag_dispatch_result<Tag, Args...>::type¶ hpx::functional::tag_dispatch_result_t<Tag, Args...>
evaluates tohpx::functional::tag_dispatch_result_t<Tag, Args...>::type
Variables
-
constexpr unspecified
tag_dispatch
= unspecified¶ The
hpx::functional::tag_dispatch
name defines a constexpr object that is invocable with one or more arguments. The first argument is a ‘tag’ (typically a DPO). It is only invocable if an overload of tag_dispatch() that accepts the same arguments could be found via ADL.The evaluation of the expression
hpx::tag_dispatch(tag, args...)
is equivalent to evaluating the unqualified call totag_dispatch(decay-copy(tag), std::forward<Args>(args)...)
.hpx::functional::tag_dispatch
is implemented against P1895.Example: Defining a new customization point
foo
:namespace mylib { inline constexpr struct foo_fn final : hpx::functional::tag<foo_fn> { } foo{}; }
Defining an object
bar
which customizesfoo
:struct bar { int x = 42; friend constexpr int tag_dispatch(mylib::foo_fn, bar const& x) { return b.x; } };
Using the customization point:
static_assert(42 == mylib::foo(bar{}), "The answer is 42");
-
template<typename
Tag
, typename ...Args
>
constexpr boolis_tag_dispatchable_v
= is_tag_dispatchable<Tag, Args...>::value¶ hpx::functional::is_tag_dispatchable_v<Tag, Args...>
evaluates tohpx::functional::is_tag_dispatchable<Tag, Args...>::value
-
template<typename
Tag
, typename ...Args
>
constexpr boolis_nothrow_tag_dispatchable_v
= is_nothrow_tag_dispatchable<Tag, Args...>::value¶ hpx::functional::is_tag_dispatchable_v<Tag, Args...>
evaluates tohpx::functional::is_tag_dispatchable<Tag, Args...>::value
-
template<typename
Tag
, typename ...Args
>
structis_nothrow_tag_dispatchable
¶ - #include <tag_dispatch.hpp>
hpx::functional::is_nothrow_tag_dispatchable<Tag, Args...>
is std::true_type if an overload oftag_dispatch(tag, args...)
can be found via ADL and is noexcept.
-
template<typename
Tag
, typename ...Args
>
structis_tag_dispatchable
¶ - #include <tag_dispatch.hpp>
hpx::functional::is_tag_dispatchable<Tag, Args...>
is std::true_type if an overload oftag_dispatch(tag, args...)
can be found via ADL.
-
template<typename
Tag
>
structtag
¶ - #include <tag_dispatch.hpp>
hpx::functional::tag<Tag>
defines a base class that implements the necessary tag dispatching functionality for a given typeTag
-
template<typename
Tag
>
structtag_noexcept
¶ - #include <tag_dispatch.hpp>
hpx::functional::tag_noexcept<Tag>
defines a base class that implements the necessary tag dispatching functionality for a given typeTag
The implementation has to be noexcept
-
template<typename
-
namespace
-
namespace
hpx
-
namespace
functional
Typedefs
-
template<typename
Tag
, typename ...Args
>
usingtag_fallback_dispatch_result
= invoke_result<decltype(tag_fallback_dispatch), Tag, Args...>¶ hpx::functional::tag_fallback_dispatch_result<Tag, Args...>
is the trait returning the result type of the call hpx::functioanl::tag_fallback_dispatch. This can be used in a SFINAE context.
-
template<typename
Tag
, typename ...Args
>
usingtag_fallback_dispatch_result_t
= typename tag_fallback_dispatch_result<Tag, Args...>::type¶ hpx::functional::tag_fallback_dispatch_result_t<Tag, Args...>
evaluates tohpx::functional::tag_fallback_dispatch_result_t<Tag, Args...>::type
Variables
-
constexpr unspecified
tag_fallback_dispatch
= unspecified¶ The
hpx::functional::tag_fallback_dispatch
name defines a constexpr object that is invocable with one or more arguments. The first argument is a ‘tag’ (typically a DPO). It is only invocable if an overload of tag_fallback_dispatch() that accepts the same arguments could be found via ADL.The evaluation of the expression
hpx::functional::tag_fallback_dispatch(tag, args...)
is equivalent to evaluating the unqualified call totag_fallback_dispatch(decay-copy(tag), std::forward<Args>(args)...)
.hpx::functional::tag_fallback_dispatch
is implemented against P1895.Example: Defining a new customization point
foo
:namespace mylib { inline constexpr struct foo_fn final : hpx::functional::tag_fallback<foo_fn> { } foo{}; }
Defining an object
bar
which customizesfoo
:struct bar { int x = 42; friend constexpr int tag_fallback_dispatch(mylib::foo_fn, bar const& x) { return b.x; } };
Using the customization point:
static_assert(42 == mylib::foo(bar{}), "The answer is 42");
-
template<typename
Tag
, typename ...Args
>
constexpr boolis_tag_fallback_dispatchable_v
= is_tag_fallback_dispatchable<Tag, Args...>::value¶ hpx::functional::is_tag_fallback_dispatchable_v<Tag, Args...>
evaluates tohpx::functional::is_tag_fallback_dispatchable<Tag, Args...>::value
-
template<typename
Tag
, typename ...Args
>
constexpr boolis_nothrow_tag_fallback_dispatchable_v
= is_nothrow_tag_fallback_dispatchable<Tag, Args...>::value¶ hpx::functional::is_tag_fallback_dispatchable_v<Tag, Args...>
evaluates tohpx::functional::is_tag_fallback_dispatchable<Tag, Args...>::value
-
template<typename
Tag
, typename ...Args
>
structis_nothrow_tag_fallback_dispatchable
¶ - #include <tag_fallback_dispatch.hpp>
hpx::functional::is_nothrow_tag_fallback_dispatchable<Tag, Args...>
is std::true_type if an overload oftag_fallback_dispatch(tag, args...)
can be found via ADL and is noexcept.
-
template<typename
Tag
, typename ...Args
>
structis_tag_fallback_dispatchable
¶ - #include <tag_fallback_dispatch.hpp>
hpx::functional::is_tag_fallback_dispatchable<Tag, Args...>
is std::true_type if an overload oftag_fallback_dispatch(tag, args...)
can be found via ADL.
-
template<typename
Tag
>
structtag_fallback
¶ - #include <tag_fallback_dispatch.hpp>
hpx::functional::tag_fallback<Tag>
defines a base class that implements the necessary tag dispatching functionality for a given typeTag
-
template<typename
Tag
>
structtag_fallback_noexcept
¶ - #include <tag_fallback_dispatch.hpp>
hpx::functional::tag_fallback_noexcept<Tag>
defines a base class that implements the necessary tag dispatching functionality for a given typeTag
where the implementation is required to be noexcept
-
template<typename
-
namespace
-
namespace
hpx
-
namespace
functional
Typedefs
-
template<typename
Tag
, typename ...Args
>
usingtag_override_dispatch_result
= invoke_result<decltype(tag_override_dispatch), Tag, Args...>¶ hpx::functional::tag_override_dispatch_result<Tag, Args...>
is the trait returning the result type of the call hpx::functioanl::tag_override_dispatch. This can be used in a SFINAE context.
-
template<typename
Tag
, typename ...Args
>
usingtag_override_dispatch_result_t
= typename tag_override_dispatch_result<Tag, Args...>::type¶ hpx::functional::tag_override_dispatch_result_t<Tag, Args...>
evaluates tohpx::functional::tag_override_dispatch_result_t<Tag, Args...>::type
Variables
-
constexpr unspecified
tag_override_dispatch
= unspecified¶ The
hpx::functional::tag_override_dispatch
name defines a constexpr object that is invocable with one or more arguments. The first argument is a ‘tag’ (typically a DPO). It is only invocable if an overload of tag_override_dispatch() that accepts the same arguments could be found via ADL.The evaluation of the expression
hpx::functional::tag_override_dispatch(tag, args...)
is equivalent to evaluating the unqualified call totag_override_dispatch(decay-copy(tag), std::forward<Args>(args)...)
.hpx::functional::tag_override_dispatch
is implemented against P1895.Example: Defining a new customization point
foo
:namespace mylib { inline constexpr struct foo_fn final : hpx::functional::tag_override<foo_fn> { } foo{}; }
Defining an object
bar
which customizesfoo
:struct bar { int x = 42; friend constexpr int tag_override_dispatch(mylib::foo_fn, bar const& x) { return b.x; } };
Using the customization point:
static_assert(42 == mylib::foo(bar{}), "The answer is 42");
-
template<typename
Tag
, typename ...Args
>
constexpr boolis_tag_override_dispatchable_v
= is_tag_override_dispatchable<Tag, Args...>::value¶ hpx::functional::is_tag_override_dispatchable_v<Tag, Args...>
evaluates tohpx::functional::is_tag_override_dispatchable<Tag, Args...>::value
-
template<typename
Tag
, typename ...Args
>
constexpr boolis_nothrow_tag_override_dispatchable_v
= is_nothrow_tag_override_dispatchable<Tag, Args...>::value¶ hpx::functional::is_tag_override_dispatchable_v<Tag, Args...>
evaluates tohpx::functional::is_tag_override_dispatchable<Tag, Args...>::value
-
template<typename
Tag
, typename ...Args
>
structis_nothrow_tag_override_dispatchable
¶ - #include <tag_priority_dispatch.hpp>
hpx::functional::is_nothrow_tag_override_dispatchable<Tag, Args...>
is std::true_type if an overload oftag_override_dispatch(tag, args...)
can be found via ADL and is noexcept.
-
template<typename
Tag
, typename ...Args
>
structis_tag_override_dispatchable
¶ - #include <tag_priority_dispatch.hpp>
hpx::functional::is_tag_override_dispatchable<Tag, Args...>
is std::true_type if an overload oftag_override_dispatch(tag, args...)
can be found via ADL.
-
template<typename
Tag
>
structtag_override
¶ - #include <tag_priority_dispatch.hpp>
hpx::functional::tag_override<Tag>
defines a base class that implements the necessary tag dispatching functionality for a given typeTag
-
template<typename
Tag
>
structtag_override_noexcept
¶ - #include <tag_priority_dispatch.hpp>
hpx::functional::tag_override_noexcept<Tag>
defines a base class that implements the necessary tag dispatching functionality for a given typeTag
where the implementation is required to be noexcept
-
template<typename
-
namespace
Defines
-
HPX_UTIL_REGISTER_UNIQUE_FUNCTION_DECLARATION
(Sig, F, Name)¶
-
HPX_UTIL_REGISTER_UNIQUE_FUNCTION
(Sig, F, Name)¶
-
namespace
hpx
-
namespace
util
-
-
template<typename
R
, typename ...Ts
, boolSerializable
>
classunique_function
<R(Ts...), Serializable> : public detail::basic_function<R(Ts...), false, Serializable>¶ Public Types
-
typedef R
result_type
¶
Public Functions
-
unique_function
(unique_function&&)¶
-
unique_function &
operator=
(unique_function&&)¶
Private Types
-
template<>
usingbase_type
= detail::basic_function<R(Ts...), false, Serializable>¶
-
typedef R
-
template<typename
-
namespace
-
template<typename
R
, typenameObj
, typename ...Ts
>
structget_function_address
<R (Obj::*)(Ts...) const>¶
-
namespace
hpx
-
namespace
hpx
-
namespace
hpx
-
namespace
hpx
Variables
-
template<typename F, typename... Ts>HPX_INLINE_CONSTEXPR_VARIABLE bool hpx::is_invocable_v=is_invocable<F, Ts...>::value
-
template<typename R, typename F, typename... Ts>HPX_INLINE_CONSTEXPR_VARIABLE bool hpx::is_invocable_r_v=is_invocable_r<R, F, Ts...>::value
-
namespace
traits
-
-
namespace
hpx
-
namespace
traits
-
template<typename
T
>
structis_placeholder
¶ - #include <is_placeholder.hpp>
If
T
is a standard, Boost, or HPX placeholder (_1, _2, _3, …) then this template is derived fromstd::integral_constant<int, 1>
,std::integral_constant<int, 2>
,std::integral_constant<int, 3>
, respectively. Otherwise it is derived from ,std::integral_constant<int, 0>
.
-
template<typename
-
namespace