 st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_invocable, st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_invocable_r, st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_nothrow_invocable, st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_nothrow_invocable_r    Defined in header <type_traits>         template <class Fn, class... ArgTypes>
struct is_invocable;
  (1)   (since C++17)     template <class R, class Fn, class... ArgTypes>
struct is_invocable_r;
  (2)   (since C++17)     template <class Fn, class... ArgTypes>
struct is_nothrow_invocable;
  (3)   (since C++17)     template <class R, class Fn, class... ArgTypes>
struct is_nothrow_invocable_r;
  (4)   (since C++17)    
1) Determines whether Fn can be invoked with the arguments ArgTypes.... Formally, determines whether INVOKE(st8b7c:f320:99b9:690f:4595:cd17:293a:c069declval<Fn>(), st8b7c:f320:99b9:690f:4595:cd17:293a:c069declval<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 and the implicit conversion does not bind a reference to a temporary object (since C++23). If R is cv void, the result can be any type. Formally, determines whether INVOKE<R>(st8b7c:f320:99b9:690f:4595:cd17:293a:c069declval<Fn>(), st8b7c:f320:99b9:690f:4595:cd17:293a:c069declval<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 and the implicit conversion does not bind a reference to a temporary object (since C++23) (same as (2)), and that such call (including the conversion of the parameters and the result) is known not to throw any exceptions. If R is cv void, the result can be any type (same as (2)). The converson of the parameters and the call itself still has to be 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.
The behavior of a program that adds specializations for any of the templates described on this page is undefined.
  Helper variable templates     Defined in header <type_traits>         template <class Fn, class... ArgTypes>
inline constexpr bool is_invocable_v = 
    st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_invocable<Fn, ArgTypes...>8b7c:f320:99b9:690f:4595:cd17:293a:c069value;
  (1)   (since C++17)     template <class R, class Fn, class... ArgTypes>
inline constexpr bool is_invocable_r_v = 
    st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_invocable_r<R, Fn, ArgTypes...>8b7c:f320:99b9:690f:4595:cd17:293a:c069value;
  (2)   (since C++17)     template <class Fn, class... ArgTypes>
inline constexpr bool is_nothrow_invocable_v = 
    st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_nothrow_invocable<Fn, ArgTypes...>8b7c:f320:99b9:690f:4595:cd17:293a:c069value;
  (3)   (since C++17)     template <class R, class Fn, class... ArgTypes>
inline constexpr bool is_nothrow_invocable_r_v = 
    st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_nothrow_invocable_r<R, Fn, ArgTypes...>8b7c:f320:99b9:690f:4595:cd17:293a:c069value;
  (4)   (since C++17)   
  Inherited from  st8b7c:f320:99b9:690f:4595:cd17:293a:c069integral_constant
  Member constants    value
[static]   true if INVOKE<R>(declval<Fn>(), declval<ArgTypes>()...) is well formed when treated as an unevaluated operand , false otherwise  (public static member constant) 
   Member functions    operator bool   converts the object to bool, returns value  (public member function) 
   operator()
(C++14)   returns value  (public member function) 
   Member types    Type   Definition 
   value_type   bool 
   type   st8b7c:f320:99b9:690f:4595:cd17:293a:c069integral_constant<bool, value> 
    Examples  #include <type_traits>
 
auto func2(char) -> int (*)()
{
    return nullptr;
}
 
int main()
{
    static_assert( st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_invocable_v<int()> );
    static_assert( not st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_invocable_v<int(), int> );
    static_assert( st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_invocable_r_v<int, int()> );
    static_assert( not st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_invocable_r_v<int*, int()> );
    static_assert( st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_invocable_r_v<void, void(int), int> );
    static_assert( not st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_invocable_r_v<void, void(int), void> );
    static_assert( st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_invocable_r_v<int(*)(), decltype(func2), char> );
    static_assert( not st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_invocable_r_v<int(*)(), decltype(func2), void> );
}   See also     invokeinvoke_r
(C++17)(C++23)   invokes any Callable object with given arguments and possibility to specify return type (since C++23)  (function template) 
    result_ofinvoke_result
(C++11)(removed in C++20)(C++17)   deduces the result type of invoking a callable object with a set of arguments  (class template) 
    declval
(C++11)   obtains a reference to its argument for use in unevaluated context  (function template) 
    invocableregular_invocable
(C++20)   specifies that a callable type can be invoked with a given set of argument types  (concept) 
  

    
{'path': 'public/docs/cpp/types/is_invocable.html', 'source': 'DevDocs.IO'}