Movatterモバイル変換


[0]ホーム

URL:



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

1231.weak_ptr comparisons incompletely resolved

Section: 20.3.2.3.6[util.smartptr.weak.obs]Status:C++11Submitter: Daniel KrüglerOpened: 2009-10-10Last modified: 2016-01-28

Priority:Not Prioritized

View all otherissues in [util.smartptr.weak.obs].

View all issues withC++11 status.

Discussion:

Then2637paper suggested several updates of the ordering semantics ofshared_ptrandweak_ptr, among those the explicit comparison operators ofweak_ptr wereremoved/deleted, instead a corresponding functorowner_less was added.The problem is thatn2637did not clearly enough specify, how the previous wording parts describingthe comparison semantics ofweak_ptr should be removed.

[2009-11-06 Howard adds:]

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

Proposed resolution:

  1. Change 20.3.2.3[util.smartptr.weak]/2 as described, the intention is to fixthe now no longer valid requirement thatweak_ptr isLessComparable [Note the deleted comma]:

    Specializations ofweak_ptr shall beCopyConstructible,andCopyAssignable,andLessThanComparable, allowing their use in standard containers.

  2. In 20.3.2.3.6[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 byoperator<,!(a< b) && !(b < a), twoweak_ptr instances areequivalent if and only if they share ownership or are both empty.

    Throws: nothing.

    [Note: Allowsweak_ptr objects to be used as keys in associativecontainers. —end note]


[8]ページ先頭

©2009-2026 Movatter.jp