deduction guides for
std::function_ref
From cppreference.net
<
cpp
|
utility
|
functional
|
function ref
C++
Utilities library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Function objects
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Old binders and adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
定义于头文件
<functional>
|
||
|
template
<
class
F
>
function_ref ( F * ) - > function_ref < F > ; |
(1) | (C++26 起) |
|
template
<
auto
f
>
function_ref ( std:: nontype_t < f > ) - > function_ref < /*见下文*/ > ; |
(2) | (C++26 起) |
|
template
<
auto
f,
class
T
>
function_ref ( std:: nontype_t < f > , T && ) - > function_ref < /*见下文*/ > ; |
(3) | (C++26 起) |
2)
令类型
F
为
std::
remove_pointer_t
<
decltype
(
f
)
>
。此重载仅当
std::
is_function_v
<
F
>
为
true
时参与重载决议。推导出的类型为
std::
function_ref
<
F
>
。
3)
令类型
F
为
decltype
(
f
)
。此重载仅当满足以下条件时才参与重载决议:
- F 的形式为 R ( G :: * ) ( A... ) noexcept ( E ) (可选的 cv 限定,可选的 noexcept,可选的左值引用限定),其中 G 为某类型,或
- F 的形式为 M G :: * ,其中 G 为某类型且 M 为对象类型,此时令 R 为 std:: invoke_result_t < F, T & > , A... 为空包,且 E 为 false,或
- F 的形式为 R ( * ) ( G, A... ) noexcept ( E ) ,其中 G 为某类型。
-
- 推导出的类型为 std:: function_ref < R ( A... ) noexcept ( E ) > 。
示例
|
本节内容不完整
原因:缺少示例 |