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

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

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 23.11.1.2.3 [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 fromget_deleter() = std::forward<D>(u.get_deleter()).

  2. Edit 23.11.1.2.3 [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 fromget_deleter() = std::forward<E>(u.get_deleter()).