This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.

### 2246. `unique_ptr` assignment effects w.r.t. deleter

Section: 20.11.1.3.4 [unique.ptr.single.asgn] Status: C++14 Submitter: Jonathan Wakely Opened: 2013-03-13 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [unique.ptr.single.asgn].

View all issues with C++14 status.

Discussion:

The Effects clauses for `unique_ptr` assignment don't make sense, what is the target of "an assignment from `std::forward<D>(u.get_deleter())`"?

Obviously it's intended to be the deleter, but that isn't stated clearly.

[2013-04-20, Bristol]

Move to Ready

[2013-09-29, Chicago]

Apply to Working Paper

Proposed resolution:

This wording is relative to N3485.

1. Edit 20.11.1.3.4 [unique.ptr.single.asgn] paragraph 2:

   >     unique_ptr& operator=(unique_ptr&& u) noexcept;

   > > […]

   > > -2- Effects: Transfers ownership from `u` to `*this` as if by calling `reset(u.release())` followed by an assignment from `get_deleter() = std::forward<D>(u.get_deleter())`.

2. Edit 20.11.1.3.4 [unique.ptr.single.asgn] paragraph 6:

   >     template <class U, class E> unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept;

   > > […]

   > > -6- Effects: Transfers ownership from `u` to `*this` as if by calling `reset(u.release())` followed by an assignment from `get_deleter() = std::forward<E>(u.get_deleter())`.