Title
Remove constexpr from owner_less and owner_before
Status
immediate
Section
[util.smartptr.shared.obs] [util.smartptr.weak.obs] [util.smartptr.ownerless]
Submitter
Tim Song

Created on 2026-03-25.00:00:00 last changed 5 days ago

Messages

Date: 2026-03-25.13:29:12

Proposed resolution:

This wording is relative to N5032.

  1. Modify [util.smartptr.shared.general], class template `shared_ptr` synopsis, as indicated:

    namespace std {
      template<class T> class shared_ptr {
      public:
        […]
        template<class U>
          constexpr bool owner_before(const shared_ptr<U>& b) const noexcept;
        template<class U>
          constexpr bool owner_before(const weak_ptr<U>& b) const noexcept;
        size_t owner_hash() const noexcept;
        template<class U>
          constexpr bool owner_equal(const shared_ptr<U>& b) const noexcept;
        template<class U>
          constexpr bool owner_equal(const weak_ptr<U>& b) const noexcept;
      };
    
      […]
    }
    
  2. Modify [util.smartptr.shared.obs] as indicated:

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

    -19- […]

  3. Modify [util.smartptr.weak.general], class template `weak_ptr` synopsis, as indicated:

    namespace std {
      template<class T> class weak_ptr {
      public:
        […]
        template<class U>
          constexpr bool owner_before(const shared_ptr<U>& b) const noexcept;
        template<class U>
          constexpr bool owner_before(const weak_ptr<U>& b) const noexcept;
        size_t owner_hash() const noexcept;
        template<class U>
          constexpr bool owner_equal(const shared_ptr<U>& b) const noexcept;
        template<class U>
          constexpr bool owner_equal(const weak_ptr<U>& b) const noexcept;
      };
    
      […]
    }
    
  4. Modify [util.smartptr.weak.obs] as indicated:

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

    -4- […]

  5. Modify [util.smartptr.ownerless], class template `owner_less` synopsis, as indicated:

    namespace std {
      template<class T = void> struct owner_less;
    
      template<class T> struct owner_less<shared_ptr<T>> {
        constexpr bool operator()(const shared_ptr<T>&, const shared_ptr<T>&) const noexcept;
        constexpr bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept;
        constexpr bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept;
      };
    
      template<class T> struct owner_less<weak_ptr<T>> {
        constexpr bool operator()(const weak_ptr<T>&, const weak_ptr<T>&) const noexcept;
        constexpr bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept;
        constexpr bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept;
      };
    
      template<> struct owner_less<void> {
        template<class T, class U>
          constexpr bool operator()(const shared_ptr<T>&, const shared_ptr<U>&) const noexcept;
        template<class T, class U>
          constexpr bool operator()(const shared_ptr<T>&, const weak_ptr<U>&) const noexcept;
        template<class T, class U>
          constexpr bool operator()(const weak_ptr<T>&, const shared_ptr<U>&) const noexcept;
        template<class T, class U>
          constexpr bool operator()(const weak_ptr<T>&, const weak_ptr<U>&) const noexcept;
    
        using is_transparent = unspecified;
      };
    }
    
Date: 2026-03-25.13:29:12

[ Croydon 2026-03-25; move to Immediate. ]

Date: 2026-03-25.00:00:00

Addresses US 75-138

LEWG decided to remove `constexpr` from `owner_before` and `owner_less`.

History
Date User Action Args
2026-03-25 13:29:12adminsetmessages: + msg16080
2026-03-25 13:29:12adminsetstatus: new -> immediate
2026-03-25 11:41:44adminsetmessages: + msg16075
2026-03-25 00:00:00admincreate