std::copyable_function::operator()
来自cppreference.com
< cpp | utility | functional | copyable function
R operator()( Args... args ) /*cv*/ /*ref*/ noexcept(/*noex*/); |
(C++26 起) | |
以形参 args
调用所存储可调用目标。operator() 的 /*cv*/、/*ref*/ 和 /*noex*/ 部分与 std::copyable_function
的这些模板形参相同。
等价于 return std::invoke_r<R>(/*cv-ref-cast*/(f), std::forward<Args>(args)...);,其中 f
为无 cv 限定的左值并代表 *this 的目标对象,且 /*cv-ref-cast*/(f) 等价于:
- f,若 cv ref 为空或为 &,或者
- std::as_const(f),若 cv ref 为 const 或为 const &,或者
- std::move(f),若 cv ref 为 &&,或者
- std::move(std::as_const(f)),若 cv ref 为 const &&。
当 *this 为空时行为未定义。
目录 |
[编辑] 参数
args | - | 要传递给所存储的可调用对象的形参 |
[编辑] 返回值
std::invoke_r<R>(/*cv-ref-cast*/(f), std::forward<Args>(args)...)。
[编辑] 异常
传播底层函数调用所抛出的异常。
[编辑] 示例
本节未完成 原因:暂无示例 |
[编辑] 参阅
调用目标 ( std::function<R(Args...)> 的公开成员函数)
| |
调用目标 ( std::move_only_function 的公开成员函数)
| |
调用其所存储的函数 ( std::reference_wrapper<T> 的公开成员函数)
| |
(C++17)(C++23) |
以给定实参和可能指定的返回类型(C++23 起)调用任意可调用 (Callable) 对象 (函数模板) |