定义于头文件
<type_traits>
|
||
template <class Fn, class... ArgTypes>
struct is_invocable; |
(1) | (C++17 起) |
template <class R, class Fn, class... ArgTypes>
struct is_invocable_r; |
(2) | (C++17 起) |
template <class Fn, class... ArgTypes>
struct is_nothrow_invocable; |
(3) | (C++17 起) |
template <class R, class Fn, class... ArgTypes>
struct is_nothrow_invocable_r; |
(4) | (C++17 起) |
Fn
能否以参数 ArgTypes...
调用。正式地说,是确定在当成不求值运算数处理时 INVOKE(declval<Fn>(), declval<ArgTypes>()...)
是否良态,其中 INVOKE
是定义于可调用 (Callable
) 的运算。Fn
能否以参数 ArgTypes...
调用,并生成可转换到 R
的结果。正式地说,是确定当成不求值运算数处理时 INVOKE<R>(declval<Fn>(), declval<ArgTypes>()...)
是否良态,其中 INVOKE
是定义于可调用 (Callable
) 的运算。Fn
能否以参数 ArgTypes...
调用(同 (1) ),且已知该调用不抛出任何异常。Fn
能否以参数 ArgTypes...
调用并生成可转换到 R
的结果(同 (2) ),且已知该调用不抛出任何异常。Fn, R
及所有形式参数包 ArgTypes
中的类型 应均为完整类型、(可为 cv 限定的) void ,或未知边界数组。否则行为未定义。
目录 |
定义于头文件
<type_traits>
|
||
template <class Fn, class... ArgTypes>
inline constexpr bool is_invocable_v = std::is_invocable<Fn, ArgTypes...>::value; |
(1) | (C++17 起) |
template <class R, class Fn, class... ArgTypes>
inline constexpr bool is_invocable_r_v = std::is_invocable_r<R, Fn, ArgTypes...>::value; |
(2) | (C++17 起) |
template <class Fn, class... ArgTypes>
inline constexpr bool is_nothrow_invocable_v = std::is_nothrow_invocable<Fn, ArgTypes...>::value; |
(3) | (C++17 起) |
template <class R, class Fn, class... ArgTypes>
inline constexpr bool is_nothrow_invocable_r_v = std::is_nothrow_invocable_r<R, Fn, ArgTypes...>::value; |
(4) | (C++17 起) |
value
[静态]
|
若在当成不求值运算数处理时INVOKE<R>(declval<Fn>(), declval<ArgTypes>()...) 为良态则为 true ,否则为 false (公开静态成员常量) |
operator bool
|
转换对象为 bool ,返回 value (公开成员函数) |
operator()
(C++14)
|
返回 value (公开成员函数) |
类型 | 定义 |
value_type
|
bool
|
type
|
std::integral_constant<bool, value> |
本节未完成 原因:暂无示例 |
(C++17)
|
以给定参数调用任何可调用 (Callable ) 对象 (函数模板) |
(C++11)
|
推导函数调用表达式的返回类型 (类模板) |
(C++11)
|
在不求值语境中获取到其参数的引用 (函数模板) |