std::unique_ptr::operator=

From Cppreference

Jump to: navigation, search
unique_ptr& operator=( const unique_ptr&& r );
(1) (C++11 feature)
template< class U, class E >
unique_ptr& operator=( unique_ptr<U,E>&& r );
(1) (C++11 feature)
unique_ptr& operator=( nullptr_t );
(2) (C++11 feature)

1) Transfers ownership of u to *this as if by calling reset(u.release()) followed by an assignment from std::forward<D>(u.get_deleter()).

2) Effectively the same as calling reset().

Contents

[edit] Parameters

[edit] Return value

*this

[edit] Exceptions

noexcept specification:  
noexcept

  (C++11 feature)

[edit] Example