GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::is_invocable,std::is_invocable_r,std::is_nothrow_invocable,(3) C++ Standard Libary std::is_invocable,std::is_invocable_r,std::is_nothrow_invocable,(3)

std::is_invocable,std::is_invocable_r,std::is_nothrow_invocable, - std::is_invocable,std::is_invocable_r,std::is_nothrow_invocable,


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(std::declval<Fn>(), std::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
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>(std::declval<Fn>(), std::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
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 = (1) (since C++17)


std::is_invocable<Fn, ArgTypes...>::value;
template <class R, class Fn, class... ArgTypes>


inline constexpr bool is_invocable_r_v = (2) (since C++17)


std::is_invocable_r<R, Fn, ArgTypes...>::value;
template <class Fn, class... ArgTypes>


inline constexpr bool is_nothrow_invocable_v = (3) (since C++17)


std::is_nothrow_invocable<Fn, ArgTypes...>::value;
template <class R, class Fn, class... ArgTypes>


inline constexpr bool is_nothrow_invocable_r_v = (4) (since C++17)


std::is_nothrow_invocable_r<R, Fn, ArgTypes...>::value;

Inherited from std::integral_constant


value true if INVOKE<R>(declval<Fn>(), declval<ArgTypes>()...) is well formed
[static] when treated as an unevaluated operand , false otherwise
(public static member constant)


operator bool converts the object to bool, returns value
(public member function)
operator() returns value
(C++14) (public member function)


Type Definition
value_type bool
type std::integral_constant<bool, value>

// Run this code


#include <type_traits>


auto func2(char) -> int (*)()
{
return nullptr;
}


int main()
{
static_assert( std::is_invocable_v<int()> );
static_assert( not std::is_invocable_v<int(), int> );
static_assert( std::is_invocable_r_v<int, int()> );
static_assert( not std::is_invocable_r_v<int*, int()> );
static_assert( std::is_invocable_r_v<void, void(int), int> );
static_assert( not std::is_invocable_r_v<void, void(int), void> );
static_assert( std::is_invocable_r_v<int(*)(), decltype(func2), char> );
static_assert( not std::is_invocable_r_v<int(*)(), decltype(func2), void> );
}


invoke invokes any Callable object with given arguments
invoke_r and possibility to specify return type
(C++17) (since C++23)
(C++23) (function template)
result_of deduces the result type of invoking a callable object with
invoke_result a set of arguments
(C++11)(removed in C++20) (class template)
(C++17)
declval obtains a reference to its argument for use in unevaluated
(C++11) context
(function template)
invocable specifies that a callable type can be invoked with a given
regular_invocable set of argument types
(C++20) (concept)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.