std::is_invocable,std::is_invocable_r,std::is_nothrow_invocable,std::is_nothrow_invocable_r (3) - Linux Manuals
std::is_invocable,std::is_invocable_r,std::is_nothrow_invocable,std::is_nothrow_invocable_r: std::is_invocable,std::is_invocable_r,std::is_nothrow_invocable,std::is_nothrow_invocable_r
NAME
std::is_invocable,std::is_invocable_r,std::is_nothrow_invocable,std::is_nothrow_invocable_r - std::is_invocable,std::is_invocable_r,std::is_nothrow_invocable,std::is_nothrow_invocable_r
Synopsis
Defined in header <type_traits>
template <class Fn, class... ArgTypes> (1) (since C++17)
struct is_invocable;
template <class R, class Fn, class... ArgTypes> (2) (since C++17)
struct is_invocable_r;
template <class Fn, class... ArgTypes> (3) (since C++17)
struct is_nothrow_invocable;
template <class R, class Fn, class... ArgTypes> (4) (since C++17)
struct is_nothrow_invocable_r;
1) Determines whether Fn can be invoked with the arguments ArgTypes.... Formally, determines whether INVOKE(declval<Fn>(), declval<ArgTypes>()...) is well formed when treated as an unevaluated operand, where INVOKE is the operation defined in Callable.
2) Determines whether Fn can be invoked with the arguments ArgTypes... to yield a result that is convertible to R. Formally, determines whether INVOKE<R>(declval<Fn>(), declval<ArgTypes>()...) is well formed when treated as an unevaluated operand, where INVOKE is the operation defined in Callable
3) Determines whether Fn is callable with the arguments ArgTypes... (same as (1)), and that such call is known not to throw any exceptions.
4) Determines whether Fn can be invoked with the arguments ArgTypes... to yield a result that is convertible to R (same as (2)), and that such call (including the conversion) is known not to throw any exceptions.
Fn, R and all types in the parameter pack ArgTypes shall each be a complete type, (possibly cv-qualified) void, or an array of unknown bound. Otherwise, the behavior is undefined.
If an instantiation of a template above depends, directly or indirectly, on an incomplete type, and that instantiation could yield a different result if that type were hypothetically completed, the behavior is undefined.
Helper variable templates
Defined in header <type_traits>
template <class Fn, class... ArgTypes> (1) (since C++17)
inline constexpr bool is_invocable_v = std::is_invocable<Fn, ArgTypes...>::value;
template <class R, class Fn, class... ArgTypes> (2) (since C++17)
inline constexpr bool is_invocable_r_v = std::is_invocable_r<R, Fn, ArgTypes...>::value;
template <class Fn, class... ArgTypes> (3) (since C++17)
inline constexpr bool is_nothrow_invocable_v = std::is_nothrow_invocable<Fn, ArgTypes...>::value;
template <class R, class Fn, class... ArgTypes> (4) (since C++17)
inline constexpr bool is_nothrow_invocable_r_v = std::is_nothrow_invocable_r<R, Fn, ArgTypes...>::value;
Inherited from std::integral_constant
Member constants
value true if INVOKE<R>(declval<Fn>(), declval<ArgTypes>()...) is well formed when treated as an unevaluated operand , false otherwise
[static]
Member functions
operator bool (public member function)
operator() returns value
(C++14)
Member types
Type Definition
value_type bool
type std::integral_constant<bool, value>
Examples
// Run this code
See also
invoke invokes any Callable object with given arguments
(C++17)
result_of
invoke_result deduces the result type of invoking a callable object with a set of arguments
(C++11)(removed in C++20)
(C++17)
declval obtains a reference to its argument for use in unevaluated context
(C++11)