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-qualified, 선택적으로 noexcept, 선택적으로 lvalue reference qualified), 또는
  • 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 ) > 입니다.

예제