std::unique_ptr::operator=

From Cppreference

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

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

  (since C++11)

[edit] Example