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

1256. weak_ptr comparison functions should be removed

Section: 20.3.2.3 [util.smartptr.weak] Status: C++11 Submitter: Daniel Krügler Opened: 2009-11-04 Last modified: 2016-01-28

Priority: Not Prioritized

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

View all issues with C++11 status.

Discussion:

Additional to the necessary cleanup of the description of the the weak_ptr component from 20.3.2.3 [util.smartptr.weak] described in 1231(i) it turns out that the currently deleted comparison functions of weak_ptr are not needed at all: There is no safe-bool conversion from weak_ptr, and it won't silently chose a conversion to shared_ptr.

[ 2009-11-14 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]

Proposed resolution:

Change 20.3.2.3 [util.smartptr.weak]/1 as indicated:

namespace std {
template<class T> class weak_ptr {
public:
...
  // comparisons
  template<class Y> bool operator<(weak_ptr<Y> const&) const = delete;
  template<class Y> bool operator<=(weak_ptr<Y> const&) const = delete;
  template<class Y> bool operator>(weak_ptr<Y> const&) const = delete;
  template<class Y> bool operator>=(weak_ptr<Y> const&) const = delete;
};
...