std::copyable_function:: operator()
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Old binders and adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
R operator
(
)
(
Args...
args
)
/*cv*/
/*ref*/
noexcept
(
/*noex*/
)
;
|
(自 C++26 起) | |
使用参数
args
调用存储的可调用目标。
/*cv*/
、
/*ref*/
和
/*noex*/
部分与
std::copyable_function
模板参数的对应部分完全一致。
等价于
return
std::
invoke_r
<
R
>
(
/*cv-ref-cast*/
(
f
)
,
std::
forward
<
Args
>
(
args
)
...
)
;
,其中
f
是表示
*
this
目标对象的无cv限定左值,而
/*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)
|
以给定参数调用任意
Callable
对象
并可指定返回类型
(C++23 起)
(函数模板) |