[libcxx-commits] [libcxx] [libc++] Make `<set>` `std::set` constexpr as part of P3372R3 (PR #167241)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 30 18:04:35 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Vinay Deshmukh (vinay-deshmukh)

<details>
<summary>Changes</summary>

Fixes #<!-- -->128663 

---

Patch is 126.77 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/167241.diff


77 Files Affected:

- (modified) libcxx/docs/FeatureTestMacroTable.rst (+2) 
- (modified) libcxx/include/__node_handle (+3-1) 
- (modified) libcxx/include/__tree (+1-1) 
- (modified) libcxx/include/set (+161-91) 
- (modified) libcxx/include/version (+2) 
- (modified) libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each.associative.pass.cpp (+6-10) 
- (modified) libcxx/test/std/containers/associative/from_range_associative_containers.h (+5-5) 
- (modified) libcxx/test/std/containers/associative/set/clear.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/contains.pass.cpp (+13-4) 
- (modified) libcxx/test/std/containers/associative/set/contains_transparent.pass.cpp (+19-7) 
- (modified) libcxx/test/std/containers/associative/set/count.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/count_transparent.pass.cpp (+16-5) 
- (modified) libcxx/test/std/containers/associative/set/emplace.pass.cpp (+12-4) 
- (modified) libcxx/test/std/containers/associative/set/emplace_hint.pass.cpp (+12-4) 
- (modified) libcxx/test/std/containers/associative/set/empty.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/equal_range.pass.cpp (+10-3) 
- (modified) libcxx/test/std/containers/associative/set/equal_range_transparent.pass.cpp (+19-8) 
- (modified) libcxx/test/std/containers/associative/set/erase_iter.pass.cpp (+11-4) 
- (modified) libcxx/test/std/containers/associative/set/erase_iter_iter.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/erase_key.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/extract_iterator.pass.cpp (+11-4) 
- (modified) libcxx/test/std/containers/associative/set/extract_key.pass.cpp (+11-4) 
- (modified) libcxx/test/std/containers/associative/set/find.pass.cpp (+10-3) 
- (modified) libcxx/test/std/containers/associative/set/get_allocator.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/incomplete_type.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/insert_cv.pass.cpp (+10-3) 
- (modified) libcxx/test/std/containers/associative/set/insert_initializer_list.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/insert_iter_cv.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/insert_iter_iter.pass.cpp (+8-5) 
- (modified) libcxx/test/std/containers/associative/set/insert_iter_rv.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/insert_node_type.pass.cpp (+16-8) 
- (modified) libcxx/test/std/containers/associative/set/insert_node_type_hint.pass.cpp (+14-6) 
- (modified) libcxx/test/std/containers/associative/set/insert_range.pass.cpp (+10-2) 
- (modified) libcxx/test/std/containers/associative/set/insert_rv.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/iterator.pass.cpp (+20-13) 
- (modified) libcxx/test/std/containers/associative/set/lower_bound.pass.cpp (+10-3) 
- (modified) libcxx/test/std/containers/associative/set/max_size.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/merge.pass.cpp (+19-11) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/alloc.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp (+11-4) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/compare.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/compare_alloc.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/copy.pass.cpp (+8-5) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/copy_alloc.pass.cpp (+8-5) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp (+20-16) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/deduct.pass.cpp (+11-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/default.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/from_range.pass.cpp (+11-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp (+10-3) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp (+12-5) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/iter_iter_comp.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/move.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp (+10-3) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/move_assign.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp (+10-3) 
- (modified) libcxx/test/std/containers/associative/set/set.erasure/erase_if.pass.cpp (+11-4) 
- (modified) libcxx/test/std/containers/associative/set/set.nonmember/compare.three_way.pass.cpp (+10-4) 
- (modified) libcxx/test/std/containers/associative/set/set.nonmember/op_compare.pass.cpp (+20-13) 
- (modified) libcxx/test/std/containers/associative/set/set.observers/comp.pass.cpp (+12-3) 
- (modified) libcxx/test/std/containers/associative/set/set.special/member_swap.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/size.pass.cpp (+9-2) 
- (modified) libcxx/test/std/containers/associative/set/types.pass.cpp (+8-1) 
- (modified) libcxx/test/std/containers/associative/set/upper_bound.pass.cpp (+10-3) 
- (modified) libcxx/test/std/containers/container.node/node_handle.pass.cpp (+2-2) 
- (modified) libcxx/test/std/containers/from_range_helpers.h (+2-2) 
- (modified) libcxx/test/std/containers/insert_range_maps_sets.h (+5-5) 
- (modified) libcxx/test/std/containers/set_allocator_requirement_test_templates.h (+1-1) 
- (modified) libcxx/test/std/language.support/support.limits/support.limits.general/set.version.compile.pass.cpp (+27) 
- (modified) libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp (+27) 
- (modified) libcxx/utils/generate_feature_test_macro_components.py (+5) 


``````````diff
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 8e26bdcd860c1..a656bd80497e6 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -450,6 +450,8 @@ Status
     ---------------------------------------------------------- -----------------
     ``__cpp_lib_constexpr_queue``                              ``202502L``
     ---------------------------------------------------------- -----------------
+    ``__cpp_lib_constexpr_set``                                ``202502L``
+    ---------------------------------------------------------- -----------------
     ``__cpp_lib_constrained_equality``                         ``202411L``
     ---------------------------------------------------------- -----------------
     ``__cpp_lib_copyable_function``                            *unimplemented*
diff --git a/libcxx/include/__node_handle b/libcxx/include/__node_handle
index 789f2b5f9a52f..16ae9ed5eef16 100644
--- a/libcxx/include/__node_handle
+++ b/libcxx/include/__node_handle
@@ -169,7 +169,9 @@ template <class _NodeType, class _Derived>
 struct __set_node_handle_specifics {
   typedef typename _NodeType::__node_value_type value_type;
 
-  _LIBCPP_HIDE_FROM_ABI value_type& value() const { return static_cast<_Derived const*>(this)->__ptr_->__get_value(); }
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_type& value() const {
+    return static_cast<_Derived const*>(this)->__ptr_->__get_value();
+  }
 };
 
 template <class _NodeType, class _Derived>
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index 94c88e273870a..65d0633d676e1 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -1511,7 +1511,7 @@ private:
   }
 
   template <class _To, class _From, class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0>
-  _LIBCPP_HIDE_FROM_ABI static void __assign_value(_To& __lhs, _From&& __rhs) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void __assign_value(_To& __lhs, _From&& __rhs) {
     __lhs = std::forward<_From>(__rhs);
   }
 
diff --git a/libcxx/include/set b/libcxx/include/set
index 3f2d2cd164d2d..a8e245b22ae51 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -615,24 +615,27 @@ public:
   template <class _Key2, class _Compare2, class _Alloc2>
   friend class multiset;
 
-  _LIBCPP_HIDE_FROM_ABI set() _NOEXCEPT_(
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set() _NOEXCEPT_(
       is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
           is_nothrow_copy_constructible<key_compare>::value)
       : __tree_(value_compare()) {}
 
-  _LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp) _NOEXCEPT_(
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit set(const value_compare& __comp) _NOEXCEPT_(
       is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
       : __tree_(__comp) {}
 
-  _LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) {}
+  _LIBCPP_HIDE_FROM_ABI
+  _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit set(const value_compare& __comp, const allocator_type& __a)
+      : __tree_(__comp, __a) {}
   template <class _InputIterator>
-  _LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+  set(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
       : __tree_(__comp) {
     insert(__f, __l);
   }
 
   template <class _InputIterator>
-  _LIBCPP_HIDE_FROM_ABI
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
   set(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a)
       : __tree_(__comp, __a) {
     insert(__f, __l);
@@ -640,7 +643,7 @@ public:
 
 #  if _LIBCPP_STD_VER >= 23
   template <_ContainerCompatibleRange<value_type> _Range>
-  _LIBCPP_HIDE_FROM_ABI
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
   set(from_range_t,
       _Range&& __range,
       const key_compare& __comp = key_compare(),
@@ -652,218 +655,278 @@ public:
 
 #  if _LIBCPP_STD_VER >= 14
   template <class _InputIterator>
-  _LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+  _LIBCPP_HIDE_FROM_ABI
+  _LIBCPP_CONSTEXPR_SINCE_CXX26 set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
       : set(__f, __l, key_compare(), __a) {}
 #  endif
 
 #  if _LIBCPP_STD_VER >= 23
   template <_ContainerCompatibleRange<value_type> _Range>
-  _LIBCPP_HIDE_FROM_ABI set(from_range_t, _Range&& __range, const allocator_type& __a)
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(from_range_t, _Range&& __range, const allocator_type& __a)
       : set(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
 #  endif
 
-  _LIBCPP_HIDE_FROM_ABI set(const set& __s) = default;
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(const set& __s) = default;
 
-  _LIBCPP_HIDE_FROM_ABI set& operator=(const set& __s) = default;
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set& operator=(const set& __s) = default;
 
 #  ifndef _LIBCPP_CXX03_LANG
-  _LIBCPP_HIDE_FROM_ABI set(set&& __s) = default;
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(set&& __s) = default;
 #  endif // _LIBCPP_CXX03_LANG
 
-  _LIBCPP_HIDE_FROM_ABI explicit set(const allocator_type& __a) : __tree_(__a) {}
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit set(const allocator_type& __a) : __tree_(__a) {}
 
-  _LIBCPP_HIDE_FROM_ABI set(const set& __s, const allocator_type& __alloc) : __tree_(__s.__tree_, __alloc) {}
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(const set& __s, const allocator_type& __alloc)
+      : __tree_(__s.__tree_, __alloc) {}
 
 #  ifndef _LIBCPP_CXX03_LANG
-  _LIBCPP_HIDE_FROM_ABI set(set&& __s, const allocator_type& __alloc) : __tree_(std::move(__s.__tree_), __alloc) {}
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(set&& __s, const allocator_type& __alloc)
+      : __tree_(std::move(__s.__tree_), __alloc) {}
 
-  _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+  set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
       : __tree_(__comp) {
     insert(__il.begin(), __il.end());
   }
 
-  _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a)
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+  set(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a)
       : __tree_(__comp, __a) {
     insert(__il.begin(), __il.end());
   }
 
 #    if _LIBCPP_STD_VER >= 14
-  _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const allocator_type& __a)
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(initializer_list<value_type> __il, const allocator_type& __a)
       : set(__il, key_compare(), __a) {}
 #    endif
 
-  _LIBCPP_HIDE_FROM_ABI set& operator=(initializer_list<value_type> __il) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set& operator=(initializer_list<value_type> __il) {
     clear();
     insert(__il.begin(), __il.end());
     return *this;
   }
 
-  _LIBCPP_HIDE_FROM_ABI set& operator=(set&& __s) = default;
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set& operator=(set&& __s) = default;
 #  endif // _LIBCPP_CXX03_LANG
 
-  _LIBCPP_HIDE_FROM_ABI ~set() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~set() {
+    static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), "");
+  }
 
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT {
+    return __tree_.begin();
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT {
+    return __tree_.begin();
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT {
+    return __tree_.end();
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT {
+    return __tree_.end();
+  }
 
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT {
+    return reverse_iterator(end());
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator
+  rbegin() const _NOEXCEPT {
     return const_reverse_iterator(end());
   }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT {
+    return reverse_iterator(begin());
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const _NOEXCEPT {
     return const_reverse_iterator(begin());
   }
 
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT {
+    return begin();
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT {
+    return end();
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator
+  crbegin() const _NOEXCEPT {
+    return rbegin();
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT {
+    return rend();
+  }
 
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT {
+    return __tree_.size() == 0;
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT {
+    return __tree_.size();
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT {
+    return __tree_.max_size();
+  }
 
   // modifiers:
 #  ifndef _LIBCPP_CXX03_LANG
   template <class... _Args>
-  _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> emplace(_Args&&... __args) {
     return __tree_.__emplace_unique(std::forward<_Args>(__args)...);
   }
   template <class... _Args>
-  _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __p, _Args&&... __args) {
     return __tree_.__emplace_hint_unique(__p, std::forward<_Args>(__args)...).first;
   }
 #  endif // _LIBCPP_CXX03_LANG
 
-  _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__emplace_unique(__v); }
-  _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(const value_type& __v) {
+    return __tree_.__emplace_unique(__v);
+  }
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) {
     return __tree_.__emplace_hint_unique(__p, __v).first;
   }
 
   template <class _InputIterator>
-  _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __first, _InputIterator __last) {
     __tree_.__insert_range_unique(__first, __last);
   }
 
 #  if _LIBCPP_STD_VER >= 23
   template <_ContainerCompatibleRange<value_type> _Range>
-  _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) {
     __tree_.__insert_range_unique(ranges::begin(__range), ranges::end(__range));
   }
 #  endif
 
 #  ifndef _LIBCPP_CXX03_LANG
-  _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __v) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(value_type&& __v) {
     return __tree_.__emplace_unique(std::move(__v));
   }
 
-  _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) {
     return __tree_.__emplace_hint_unique(__p, std::move(__v)).first;
   }
 
-  _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) {
+    insert(__il.begin(), __il.end());
+  }
 #  endif // _LIBCPP_CXX03_LANG
 
-  _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); }
-  _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_unique(__k); }
-  _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); }
-  _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) { return __tree_.erase(__p); }
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __k) {
+    return __tree_.__erase_unique(__k);
+  }
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l) {
+    return __tree_.erase(__f, __l);
+  }
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); }
 
 #  if _LIBCPP_STD_VER >= 17
-  _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 insert_return_type insert(node_type&& __nh) {
     _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
                                         "node_type with incompatible allocator passed to set::insert()");
     return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh));
   }
-  _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, node_type&& __nh) {
     _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
                                         "node_type with incompatible allocator passed to set::insert()");
     return __tree_.template __node_handle_insert_unique<node_type>(__hint, std::move(__nh));
   }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(key_type const& __key) {
     return __tree_.template __node_handle_extract<node_type>(__key);
   }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(const_iterator __it) {
     return __tree_.template __node_handle_extract<node_type>(__it);
   }
   template <class _Compare2>
-  _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>& __source) {
     _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
         __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
     __tree_.__node_handle_merge_unique(__source.__tree_);
   }
   template <class _Compare2>
-  _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>&& __source) {
     _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
         __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
     __tree_.__node_handle_merge_unique(__source.__tree_);
   }
   template <class _Compare2>
-  _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+  merge(multiset<key_type, _Compare2, allocator_type>& __source) {
     _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
         __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
     __tree_.__node_handle_merge_unique(__source.__tree_);
   }
   template <class _Compare2>
-  _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+  merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
     _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
         __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
     __tree_.__node_handle_merge_unique(__source.__tree_);
   }
 #  endif
 
-  _LIBCPP_HIDE_FROM_ABI void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { __tree_.swap(__s.__tree_); }
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
+    __tree_.swap(__s.__tree_);
+  }
 
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT {
+    return __tree_.__alloc();
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const {
+    return __tree_.value_comp();
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
+    return __tree_.value_comp();
+  }
 
   // set operations:
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __k) {
+    return __tree_.find(__k);
+  }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __k) const {
+    return __tree_.find(__k);
+  }
 #  if _LIBCPP_STD_VER >= 14
   template <typename _K2,
             ...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/167241


More information about the libcxx-commits mailing list