2400. shared_ptr's get_deleter() should use addressof()

Section: 20.3.2.2.11 [util.smartptr.getdeleter] Status: C++17 Submitter: Stephan T. Lavavej Opened: 2014-06-14 Last modified: 2017-07-30

Priority: 0

View all other issues in [util.smartptr.getdeleter].

View all issues with C++17 status.

Discussion:

The Standard Library should consistently use addressof() to defend itself against overloaded operator&().

While we're in the neighbourhood, we should editorially change 0 to nullptr.

[2014-06-16 Rapperswil]

Move to Ready

Proposed resolution:

This wording is relative to N3936.

  1. Change 20.3.2.2.11 [util.smartptr.getdeleter] as indicated:

    template <class D, class T> get_deleter(const shared_ptr<T>& p) noexcept;
    

    -1- Returns: If p owns a deleter d of type cv-unqualified D, returns &std::addressof(d); otherwise returns 0nullptr. […]