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

### 2083. const-qualification on `weak_ptr::owner_before`

Section: 20.3.2.3 [util.smartptr.weak], 20.3.2.3.6 [util.smartptr.weak.obs] Status: C++14 Submitter: Ai Azuma Opened: 2011-09-06 Last modified: 2016-01-28

Priority: Not Prioritized

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

View all issues with C++14 status.

Discussion:

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 20.3.2.4 [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.

[2012, Kona]

Move to Ready.

[2012, Portland: applied to WP]

Proposed resolution:

This wording is relative to the FDIS.

1. Change the class template `weak_ptr` synopsis in 20.3.2.3 [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 20.3.2.3.6 [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;