@@ -551,8 +551,8 @@ public:
551
551
__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__p);
552
552
}
553
553
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 ;
556
556
__tree_node_base (__tree_node_base const &) = delete ;
557
557
__tree_node_base& operator =(__tree_node_base const &) = delete ;
558
558
};
@@ -703,7 +703,8 @@ public:
703
703
704
704
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator () _NOEXCEPT : __ptr_(nullptr ) {}
705
705
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_) {}
707
708
708
709
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator *() const { return __get_np ()->__value_ ; }
709
710
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator ->() const {
@@ -834,8 +835,11 @@ public:
834
835
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_allocator& __node_alloc () _NOEXCEPT {
835
836
return __node_alloc_;
836
837
}
838
+
837
839
private:
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
+ }
839
843
840
844
public:
841
845
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type __alloc () const _NOEXCEPT {
@@ -1003,31 +1007,31 @@ public:
1003
1007
template <class _ValueT = _Tp, __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0 >
1004
1008
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1005
1009
__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 >()) {
1011
1012
__emplace_hint_unique (__p, std::move (__value.first ), std::move (__value.second ));
1012
- } else
1013
- #endif
1013
+ } else
1014
+ #endif
1014
1015
{
1015
1016
__emplace_hint_unique (__p, const_cast <key_type&&>(__value.first ), std::move (__value.second ));
1016
1017
}
1017
1018
}
1018
1019
1019
1020
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) {
1021
1023
__emplace_hint_unique (__p, std::move (__value));
1022
1024
}
1023
1025
1024
1026
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) {
1026
1029
__emplace_hint_multi (__p, const_cast <key_type&&>(__value.first ), std::move (__value.second ));
1027
1030
}
1028
1031
1029
1032
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) {
1031
1035
__emplace_hint_multi (__p, std::move (__value));
1032
1036
}
1033
1037
@@ -1186,20 +1190,18 @@ private:
1186
1190
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc (__tree&, false_type) _NOEXCEPT {}
1187
1191
1188
1192
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) {
1190
1195
using __key_type = __remove_const_t <typename value_type::first_type>;
1191
1196
1192
-
1193
- #if _LIBCPP_STD_VER >= 26
1197
+ #if _LIBCPP_STD_VER >= 26
1194
1198
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
1203
1205
1204
1206
// const_cast is not allowed at constexpr time.
1205
1207
// we get around this by deleting __lhs and creating a new node in-place
@@ -1211,13 +1213,10 @@ private:
1211
1213
using __node_value_type = __get_node_value_type_t <value_type>;
1212
1214
__node_value_type __tmp (__rhs.first , __rhs.second );
1213
1215
1214
-
1215
1216
__node_traits::construct (__na, std::addressof (__lhs), std::move (__tmp));
1216
1217
1217
-
1218
-
1219
- } else
1220
- #endif
1218
+ } else
1219
+ #endif
1221
1220
{
1222
1221
// This is technically UB, since the object was constructed as `const`.
1223
1222
// Clang doesn't optimize on this currently though.
@@ -1344,7 +1343,8 @@ private:
1344
1343
// If we already have a left node in the destination tree, reuse it and copy-assign recursively
1345
1344
if (__dest->__left_ ) {
1346
1345
__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_ )));
1348
1348
1349
1349
// Otherwise, we must create new nodes; copy-construct from here on
1350
1350
} else if (__src->__left_ ) {
@@ -1356,7 +1356,8 @@ private:
1356
1356
// Identical to the left case above, just for the right nodes
1357
1357
if (__dest->__right_ ) {
1358
1358
__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_ )));
1360
1361
} else if (__src->__right_ ) {
1361
1362
auto __new_right = __copy_construct_tree (std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_ ));
1362
1363
__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
1429
1430
}
1430
1431
1431
1432
template <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 ) {
1433
1435
if (this == std::addressof (__t ))
1434
1436
return *this ;
1435
1437
@@ -1443,8 +1445,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Co
1443
1445
if (__root ())
1444
1446
__root ()->__parent_ = __end_node ();
1445
1447
}
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 ();
1448
1451
__size_ = __t .size ();
1449
1452
1450
1453
return *this ;
@@ -1884,14 +1887,14 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) {
1884
1887
__node_allocator& __na = __node_alloc ();
1885
1888
__node_holder __h (__node_traits::allocate (__na, 1 ), _Dp (__na));
1886
1889
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
1893
1896
{
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)...);
1895
1898
}
1896
1899
1897
1900
__h.get_deleter ().__value_constructed = true ;
0 commit comments