Title
weak_ptr comparisons incompletely resolved
Status
c++11
Section
[util.smartptr.weak.obs]
Submitter
Daniel Krügler

Created on 2009-10-10.00:00:00 last changed 161 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

  1. Change [util.smartptr.weak]/2 as described, the intention is to fix the now no longer valid requirement that weak_ptr is LessComparable [Note the deleted comma]:

    Specializations of weak_ptr shall be CopyConstructible, and CopyAssignable, and LessThanComparable, allowing their use in standard containers.

  2. In [util.smartptr.weak.obs] remove the paragraphs 9-11 including prototype:

    template<class T, class U> bool operator<(const weak_ptr<T>& a, const weak_ptr<U>& b);

    Returns: an unspecified value such that

    • operator< is a strict weak ordering as described in 25.4;
    • under the equivalence relation defined by operator<, !(a < b) && !(b < a), two weak_ptr instances are equivalent if and only if they share ownership or are both empty.

    Throws: nothing.

    [Note: Allows weak_ptr objects to be used as keys in associative containers. — end note]

Date: 2009-11-06.00:00:00

[ 2009-11-06 Howard adds: ]

Moved to Tentatively Ready after 5 positive votes on c++std-lib.

Date: 2009-10-10.00:00:00

The n2637 paper suggested several updates of the ordering semantics of shared_ptr and weak_ptr, among those the explicit comparison operators of weak_ptr were removed/deleted, instead a corresponding functor owner_less was added. The problem is that n2637 did not clearly enough specify, how the previous wording parts describing the comparison semantics of weak_ptr should be removed.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg1249
2010-10-21 18:28:33adminsetmessages: + msg1248
2009-10-10 00:00:00admincreate