Title
const-qualification on weak_ptr::owner_before
Status
c++14
Section
[util.smartptr.weak] [util.smartptr.weak.obs]
Submitter
Ai Azuma

Created on 2011-09-06.00:00:00 last changed 131 months ago

Messages

Date: 2012-11-03.04:16:46

Proposed resolution:

This wording is relative to the FDIS.

  1. Change the class template weak_ptr synopsis in [util.smartptr.weak] as indicated:

    namespace std {
      template<class T> class weak_ptr {
      public:
        typedef T element_type;
        […]
        template<class U> bool owner_before(shared_ptr<U> const& b) const;
        template<class U> bool owner_before(weak_ptr<U> const& b) const;
      };
      […]
    }
    
  2. Change the prototypes in [util.smartptr.weak.obs] before p6 as indicated:

    template<class U> bool owner_before(shared_ptr<U> const& b) const;
    template<class U> bool owner_before(weak_ptr<U> const& b) const;
    
Date: 2012-11-03.04:16:46

[ 2012, Portland: applied to WP ]

Date: 2012-02-27.16:24:02

[ 2012, Kona ]

Move to Ready.

Date: 2011-09-06.00:00:00

Is there any reason why weak_ptr::owner_before member function templates are not const-qualified?

Daniel Krügler:

I don't think so. To the contrary, without these to be const member function templates, the semantics of the specializations owner_less<weak_ptr<T>> and owner_less<shared_ptr<T>> described in [util.smartptr.ownerless] is unclear.

It is amusing to note that this miss has remain undetected from the accepted paper n2637 on. For the suggested wording changes see below.

History
Date User Action Args
2014-02-20 13:20:35adminsetstatus: wp -> c++14
2012-11-03 04:16:46adminsetmessages: + msg6267
2012-10-25 12:46:45adminsetstatus: voting -> wp
2012-10-16 15:35:12adminsetstatus: ready -> voting
2012-02-27 16:24:02adminsetmessages: + msg6021
2012-02-12 18:36:43adminsetstatus: new -> ready
2011-11-24 21:48:28adminsetmessages: + msg5899
2011-09-06 00:00:00admincreate