Namespaces
Variants

std::experimental::function<R(Args...)>:: operator=

From cppreference.net
function & operator = ( const function & other ) ;
(1) (라이브러리 fundamentals TS)
function & operator = ( function && other ) ;
(2) (라이브러리 fundamentals TS)
function & operator = ( std:: nullptr_t ) noexcept ;
(3) (라이브러리 fundamentals TS)
template < class F >
function & operator = ( F && f ) ;
(4) (라이브러리 fundamentals TS)
(5)
template < class F >
function & operator = ( std:: reference_wrapper < F > f ) ;
(라이브러리 fundamentals TS)
template < class F >
function & operator = ( std:: reference_wrapper < F > f ) noexcept ;
(라이브러리 fundamentals TS v3)

std::experimental::function 에 새로운 대상 을 할당합니다. 아래 설명에서 ALLOCATOR_OF ( f ) f 의 생성 시 지정된 할당자를 의미하며, 할당자가 지정되지 않은 경우 생성 시점의 std:: experimental :: pmr :: get_default_resource ( ) (라이브러리 펀더멘털 TS v3 이전) 기본 생성된 std:: pmr :: polymorphic_allocator <> (라이브러리 펀더멘털 TS v3) 을 의미합니다.

1) other target 복사본을 할당합니다. 마치 function ( std:: allocator_arg , ALLOCATOR_OF ( * this ) , other ) . swap ( * this ) ; 을 실행하는 것처럼 동작합니다.
2) other 대상 * this 로 이동합니다. 이는 마치 function ( std:: allocator_arg , ALLOCATOR_OF ( * this ) , std :: move ( other ) ) . swap ( * this ) ; 을 실행하는 것과 같습니다. other 는 지정되지 않은 값을 가진 유효한 상태에 있습니다.
3) 대상 을 파괴합니다. * this . * this 는 호출 후 비어 있습니다 . 할당 후 get_memory_resource() 가 반환하는 메모리 리소스는 할당 전의 메모리 리소스와 동등하지만, 주소는 변경될 수 있습니다.
4) target 을 호출 가능한 f 로 설정합니다. 마치 function ( std:: allocator_arg , ALLOCATOR_OF ( * this ) , std:: forward < F > ( f ) ) . swap ( * this ) ; 를 실행하는 것처럼 동작합니다. 이 연산자는 f 가 인수 타입 Args... 와 반환 타입 R 에 대해 Callable 이 아닌 경우 오버로드 해결에 참여하지 않습니다.
5) target f 의 복사본으로 설정합니다. 마치 function ( std:: allocator_arg , ALLOCATOR_OF ( * this ) , f ) . swap ( * this ) ; 를 실행하는 것과 같습니다.

목차

매개변수

other - 복사하거나 이동할 다른 std::experimental::function 객체
f - target 을 초기화할 호출 가능 객체
타입 요구사항
-
F Callable 요구사항을 충족해야 함

반환값

* this

예외

1,2,4) 저장소의 필요 할당 또는 * this 의 대상 초기화 시 예외가 발생하는 경우.
5) (없음)

참고 사항

이동 할당 연산자는 저장 공간을 할당해야 할 수 있습니다. 만약 get_memory_resource ( ) ! = other. get_memory_resource ( ) (라이브러리 펀더멘털 TS v3 이전) get_allocator ( ) ! = other. get_allocator ( ) (라이브러리 펀더멘털 TS v3부터)