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

4557. Remove constexpr from owner_less and owner_before

Section: 20.3.2.2.6 [util.smartptr.shared.obs], 20.3.2.3.6 [util.smartptr.weak.obs], 20.3.2.4 [util.smartptr.ownerless] Status: Immediate Submitter: Tim Song Opened: 2026-03-25 Last modified: 2026-03-25

Priority: Not Prioritized

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

View all issues with Immediate status.

Discussion:

Addresses US 75-138

LEWG decided to remove constexpr from owner_before and owner_less.

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

Proposed resolution:

This wording is relative to N5032.

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