Title
Add noexcept to several shared_ptr related functions
Status
c++17
Section
[util.smartptr.shared]
Submitter
United States

Created on 2017-02-03.00:00:00 last changed 89 months ago

Messages

Date: 2017-03-03.22:08:49

Proposed resolution:

This wording is relative to N4640.

  1. Modify [util.smartptr.shared] as indicated:

      template<class U> bool owner_before(const shared_ptr<U>& b) const noexcept;
      template<class U> bool owner_before(const weak_ptr<U>& b) const noexcept;
    
  2. Modify [util.smartptr.shared.obs] as indicated:

    template<class U> bool owner_before(const shared_ptr<U>& b) const noexcept;
    template<class U> bool owner_before(const weak_ptr<U>& b) const noexcept;
    
  3. Modify [util.smartptr.ownerless] as indicated:

    template<class T> struct owner_less<shared_ptr<T>> {
       bool operator()(const shared_ptr<T>&, const shared_ptr<T>&) const noexcept;
       bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept;
       bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept;
    };
    
    template<class T> struct owner_less<weak_ptr<T>> {
       bool operator()(const weak_ptr<T>&, const weak_ptr<T>&) const noexcept;
       bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept;
       bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept;
    };
    
    template<> struct owner_less<void> {
       template<class T, class U>
          bool operator()(const shared_ptr<T>&, const shared_ptr<U>&) const noexcept;
       template<class T, class U>
          bool operator()(const shared_ptr<T>&, const weak_ptr<U>&) const noexcept;
       template<class T, class U>
          bool operator()(const weak_ptr<T>&, const shared_ptr<U>&) const noexcept;
       template<class T, class U>
          bool operator()(const weak_ptr<T>&, const weak_ptr<U>&) const noexcept;
       using is_transparent = unspecified;
    };
    
Date: 2017-03-03.22:08:49

[ Kona 2017-02-27 ]

Accepted as Immediate to resolve NB comment.

Date: 2017-02-15.00:00:00

[ 2017-02-20, Marshall adds wording ]

Date: 2017-02-03.00:00:00

Addresses US 124

Several shared_ptr related functions have wide contracts and cannot throw, so should be marked unconditionally noexcept.

Proposed change:

Add noexcept to:

template<class U> 
bool 
shared_ptr::owner_before(shared_ptr<U> const& b) const noexcept;
 
template<class U> 
bool 
shared_ptr::owner_before(weak_ptr<U> const& b) const noexcept;

template<class U> 
bool  
weak_ptr::owner_before(shared_ptr<U> const& b) const noexcept; 

template<class U> 
bool
weak_ptr::owner_before(weak_ptr<U> const& b) const noexcept;
 
bool owner_less::operator()(A,B) const noexcept; // all versions
History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2017-03-05 23:46:08adminsetstatus: immediate -> wp
2017-03-03 22:08:49adminsetmessages: + msg9055
2017-03-03 22:08:49adminsetstatus: new -> immediate
2017-02-20 20:55:10adminsetmessages: + msg8960
2017-02-20 20:55:10adminsetmessages: + msg8959
2017-02-03 00:00:00admincreate