Namespaces
Variants

std::auto_ptr<T>:: operator auto_ptr<Y>

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
template < class Y >
operator auto_ptr_ref < Y > ( ) throw ( ) ;
(1) (C++11에서 사용 중단됨)
(C++17에서 제거됨)
template < class Y >
operator auto_ptr < Y > ( ) throw ( ) ;
(2) (C++11에서 사용 중단됨)
(C++17에서 제거됨)

* this 를 다른 타입 Y 에 대한 auto_ptr 로 변환합니다.

1) * this 에 대한 참조를 보유하는 구현 정의 타입을 반환합니다. std::auto_ptr 는 이 템플릿으로부터 변환 가능 하고 할당 가능 합니다. 구현체는 이 템플릿에 다른 이름을 제공하거나 다른 방식으로 동등한 기능을 구현할 수 있습니다.
2) auto_ptr 를 새로 생성하며, 이때 포인터는 release() 를 호출하여 획득합니다.

매개변수

(없음)

반환값

1) * this 에 대한 참조를 보유하는 구현 정의 타입.
2) release() 를 호출하여 얻은 포인터를 가진 auto_ptr .

참고 사항

auto_ptr_ref 의 생성자와 복사 할당 연산자는 이름 없는 임시 객체로부터 std::auto_ptr 을 복사 생성하고 할당할 수 있도록 제공됩니다. 복사 생성자와 복사 할당 연산자가 인자를 비-const 참조로 받기 때문에, 이들은 rvalue 인자를 직접 바인딩할 수 없습니다. 그러나 사용자 정의 변환 (1) 또는 (2) 가 실행된 후(이 과정에서 원본 auto_ptr 이 해제됨), 값으로 auto_ptr_ref 를 받는 생성자나 복사 할당 연산자를 호출할 수 있습니다. 이는 move semantics 의 초기 구현입니다.