@@ -551,8 +551,8 @@ public:
551551 __parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__p);
552552 }
553553
554- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_node_base () = default;
555- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~__tree_node_base () = default ;
554+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_node_base () = default;
555+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~__tree_node_base () = default ;
556556 __tree_node_base (__tree_node_base const &) = delete ;
557557 __tree_node_base& operator =(__tree_node_base const &) = delete ;
558558};
@@ -703,7 +703,8 @@ public:
703703
704704 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator () _NOEXCEPT : __ptr_(nullptr ) {}
705705
706- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator (__non_const_iterator __p) _NOEXCEPT : __ptr_(__p.__ptr_) {}
706+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator (__non_const_iterator __p) _NOEXCEPT
707+ : __ptr_(__p.__ptr_) {}
707708
708709 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator *() const { return __get_np ()->__value_ ; }
709710 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator ->() const {
@@ -834,8 +835,11 @@ public:
834835 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_allocator& __node_alloc () _NOEXCEPT {
835836 return __node_alloc_;
836837 }
838+
837839private:
838- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const __node_allocator& __node_alloc () const _NOEXCEPT { return __node_alloc_; }
840+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const __node_allocator& __node_alloc () const _NOEXCEPT {
841+ return __node_alloc_;
842+ }
839843
840844public:
841845 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type __alloc () const _NOEXCEPT {
@@ -1003,31 +1007,31 @@ public:
10031007 template <class _ValueT = _Tp, __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0 >
10041008 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
10051009 __insert_unique_from_orphaned_node (const_iterator __p, __get_node_value_type_t <_Tp>&& __value) {
1006-
1007- #if _LIBCPP_STD_VER >= 26
1008- if constexpr (
1009- integral_constant<bool , is_copy_constructible<decltype (__value.first )>::value >()
1010- ) {
1010+ #if _LIBCPP_STD_VER >= 26
1011+ if constexpr (integral_constant<bool , is_copy_constructible<decltype (__value.first )>::value >()) {
10111012 __emplace_hint_unique (__p, std::move (__value.first ), std::move (__value.second ));
1012- } else
1013- #endif
1013+ } else
1014+ #endif
10141015 {
10151016 __emplace_hint_unique (__p, const_cast <key_type&&>(__value.first ), std::move (__value.second ));
10161017 }
10171018 }
10181019
10191020 template <class _ValueT = _Tp, __enable_if_t <!__is_tree_value_type_v<_ValueT>, int > = 0 >
1020- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __insert_unique_from_orphaned_node (const_iterator __p, _Tp&& __value) {
1021+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1022+ __insert_unique_from_orphaned_node (const_iterator __p, _Tp&& __value) {
10211023 __emplace_hint_unique (__p, std::move (__value));
10221024 }
10231025
10241026 template <class _ValueT = _Tp, __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0 >
1025- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __insert_multi_from_orphaned_node (const_iterator __p, value_type&& __value) {
1027+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1028+ __insert_multi_from_orphaned_node (const_iterator __p, value_type&& __value) {
10261029 __emplace_hint_multi (__p, const_cast <key_type&&>(__value.first ), std::move (__value.second ));
10271030 }
10281031
10291032 template <class _ValueT = _Tp, __enable_if_t <!__is_tree_value_type_v<_ValueT>, int > = 0 >
1030- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __insert_multi_from_orphaned_node (const_iterator __p, _Tp&& __value) {
1033+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1034+ __insert_multi_from_orphaned_node (const_iterator __p, _Tp&& __value) {
10311035 __emplace_hint_multi (__p, std::move (__value));
10321036 }
10331037
@@ -1186,20 +1190,18 @@ private:
11861190 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc (__tree&, false_type) _NOEXCEPT {}
11871191
11881192 template <class _From , class _ValueT = _Tp, __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0 >
1189- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __assign_value (__get_node_value_type_t <value_type>& __lhs, _From&& __rhs) {
1193+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1194+ __assign_value (__get_node_value_type_t <value_type>& __lhs, _From&& __rhs) {
11901195 using __key_type = __remove_const_t <typename value_type::first_type>;
11911196
1192-
1193- #if _LIBCPP_STD_VER >= 26
1197+ #if _LIBCPP_STD_VER >= 26
11941198
1195- if constexpr (
1196- integral_constant<bool , is_copy_constructible<decltype (__rhs.first )>::value >()
1197- ){
1198- // we use copy, and not "move" as the constraint
1199- // because we can NOT move from `const key_type`, which is how `value_type` is defined
1200- // atleast for map
1201- // typedef pair<const key_type, mapped_type> value_type;
1202- // so we must copy it
1199+ if constexpr (integral_constant<bool , is_copy_constructible<decltype (__rhs.first )>::value >()) {
1200+ // we use copy, and not "move" as the constraint
1201+ // because we can NOT move from `const key_type`, which is how `value_type` is defined
1202+ // atleast for map
1203+ // typedef pair<const key_type, mapped_type> value_type;
1204+ // so we must copy it
12031205
12041206 // const_cast is not allowed at constexpr time.
12051207 // we get around this by deleting __lhs and creating a new node in-place
@@ -1211,13 +1213,10 @@ private:
12111213 using __node_value_type = __get_node_value_type_t <value_type>;
12121214 __node_value_type __tmp (__rhs.first , __rhs.second );
12131215
1214-
12151216 __node_traits::construct (__na, std::addressof (__lhs), std::move (__tmp));
12161217
1217-
1218-
1219- } else
1220- #endif
1218+ } else
1219+ #endif
12211220 {
12221221 // This is technically UB, since the object was constructed as `const`.
12231222 // Clang doesn't optimize on this currently though.
@@ -1344,7 +1343,8 @@ private:
13441343 // If we already have a left node in the destination tree, reuse it and copy-assign recursively
13451344 if (__dest->__left_ ) {
13461345 __dest->__left_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_assign_tree (
1347- std::__static_fancy_pointer_cast<__node_pointer>(__dest->__left_ ), std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_ )));
1346+ std::__static_fancy_pointer_cast<__node_pointer>(__dest->__left_ ),
1347+ std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_ )));
13481348
13491349 // Otherwise, we must create new nodes; copy-construct from here on
13501350 } else if (__src->__left_ ) {
@@ -1356,7 +1356,8 @@ private:
13561356 // Identical to the left case above, just for the right nodes
13571357 if (__dest->__right_ ) {
13581358 __dest->__right_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_assign_tree (
1359- std::__static_fancy_pointer_cast<__node_pointer>(__dest->__right_ ), std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_ )));
1359+ std::__static_fancy_pointer_cast<__node_pointer>(__dest->__right_ ),
1360+ std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_ )));
13601361 } else if (__src->__right_ ) {
13611362 auto __new_right = __copy_construct_tree (std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_ ));
13621363 __dest->__right_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__new_right);
@@ -1429,7 +1430,8 @@ __tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_next(__node_poin
14291430}
14301431
14311432template <class _Tp , class _Compare , class _Allocator >
1432- _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator =(const __tree& __t ) {
1433+ _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>&
1434+ __tree<_Tp, _Compare, _Allocator>::operator =(const __tree& __t ) {
14331435 if (this == std::addressof (__t ))
14341436 return *this ;
14351437
@@ -1443,8 +1445,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Co
14431445 if (__root ())
14441446 __root ()->__parent_ = __end_node ();
14451447 }
1446- __begin_node_ =
1447- __end_node ()->__left_ ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min (__end_node ()->__left_ )) : __end_node ();
1448+ __begin_node_ = __end_node ()->__left_
1449+ ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min (__end_node ()->__left_ ))
1450+ : __end_node ();
14481451 __size_ = __t .size ();
14491452
14501453 return *this ;
@@ -1884,14 +1887,14 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) {
18841887 __node_allocator& __na = __node_alloc ();
18851888 __node_holder __h (__node_traits::allocate (__na, 1 ), _Dp (__na));
18861889
1887- #if _LIBCPP_STD_VER >= 26
1888- if (__libcpp_is_constant_evaluated ()) {
1889- // note: construction of subobject of object outside its lifetime is not allowed in a constant expression
1890- std::__construct_at (std::addressof (*__h), std::forward<_Args>(__args)...);
1891- } else
1892- #endif
1890+ #if _LIBCPP_STD_VER >= 26
1891+ if (__libcpp_is_constant_evaluated ()) {
1892+ // note: construction of subobject of object outside its lifetime is not allowed in a constant expression
1893+ std::__construct_at (std::addressof (*__h), std::forward<_Args>(__args)...);
1894+ } else
1895+ #endif
18931896 {
1894- __node_traits::construct (__na, std::addressof (__h->__value_ ), std::forward<_Args>(__args)...);
1897+ __node_traits::construct (__na, std::addressof (__h->__value_ ), std::forward<_Args>(__args)...);
18951898 }
18961899
18971900 __h.get_deleter ().__value_constructed = true ;
0 commit comments