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

2873. Add noexcept to several shared_ptr related functions

Section: 20.3.2.2 [util.smartptr.shared] Status: C++17 Submitter: United States Opened: 2017年02月03日 Last modified: 2020年09月06日

Priority: Not Prioritized

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

View all issues with C++17 status.

Discussion:

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

[2017年02月20日, Marshall adds wording]

[Kona 2017年02月27日]

Accepted as Immediate to resolve NB comment.

Proposed resolution:

This wording is relative to N4640.

  1. Modify 20.3.2.2 [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 20.3.2.2.6 [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 20.3.2.4 [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;
    };
    

AltStyle によって変換されたページ (->オリジナル) /