Namespaces
Variants

deduction guides for std::function_ref

From cppreference.net
Utilities library
Function objects
Function invocation
(C++17) (C++23)
Identity function object
(C++20)
Old binders and adaptors
( until C++17* )
( until C++17* )
( until C++17* )
( until C++17* )
( until C++17* ) ( until C++17* ) ( until C++17* ) ( until C++17* )
( until C++20* )
( until C++20* )
( until C++17* ) ( until C++17* )
( until C++17* ) ( until C++17* )

( until C++17* )
( until C++17* ) ( until C++17* ) ( until C++17* ) ( until C++17* )
( until C++20* )
( until C++20* )
ヘッダーで定義 <functional>
template < class F >
function_ref ( F * ) - > function_ref < F > ;
(1) (C++26以降)
template < auto f >
function_ref ( std:: nontype_t < f > ) - > function_ref < /*see below*/ > ;
(2) (C++26以降)
template < auto f, class T >
function_ref ( std:: nontype_t < f > , T && ) - > function_ref < /*see below*/ > ;
(3) (C++26以降)
1) このオーバーロードは、 std:: is_function_v < F > true の場合にのみ、オーバーロード解決に参加します。
2) F std:: remove_pointer_t < decltype ( f ) > とする。このオーバーロードは、 std:: is_function_v < F > true である場合にのみオーバーロード解決に参加する。推定される型は std:: function_ref < F > である。
3) F decltype ( f ) とする。このオーバーロードは以下の場合にのみオーバーロード解決に参加する:
  • F が型 G に対する形式 R ( G :: * ) ( A... ) noexcept ( E ) である場合(任意でcv修飾、任意でnoexcept、任意で左辺値参照修飾)、または
  • F が型 G とオブジェクト型 M に対する形式 M G :: * である場合。この場合、 R std:: invoke_result_t < F, T & > A... を空のパック、 E をfalseとする、または
  • F が型 G に対する形式 R ( * ) ( G, A... ) noexcept ( E ) である場合。
推論される型は std:: function_ref < R ( A... ) noexcept ( E ) > です。