Namespaces
Variants

std::copyable_function:: operator()

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* )
R operator ( ) ( Args... args ) /*cv*/ /*ref*/ noexcept ( /*noex*/ ) ;
(C++26부터)

저장된 호출 가능 대상(callable target)을 매개변수 args 로 호출합니다. /*cv*/ , /*ref*/ , 그리고 /*noex*/ 부분들은 operator ( ) 의 템플릿 매개변수와 std::copyable_function 의 템플릿 매개변수가 동일합니다.

다음 코드와 동일합니다: return std:: invoke_r < R > ( /*cv-ref-cast*/ ( f ) , std:: forward < Args > ( args ) ... ) ; , 여기서 f * this 의 대상 객체를 나타내는 cv-unqualified 좌측값이며, /*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...)> 의 public member function)
대상 호출
( std::move_only_function 의 public member function)
저장된 함수 호출
( std::reference_wrapper<T> 의 public member function)
(C++17) (C++23)
주어진 인수로 모든 Callable 객체 호출 및 반환 타입 지정 가능 (C++23부터)
(function template)