@@ -936,7 +936,7 @@ public:
936936 if (__other.size () == 0 )
937937 return ;
938938
939- *__root_ptr () = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_construct_tree (__other.__root ()));
939+ *__root_ptr () = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_construct_tree (__other.__root ()));
940940 __root ()->__parent_ = __end_node ();
941941 __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min (__end_node ()->__left_ ));
942942 __size_ = __other.size ();
@@ -1058,61 +1058,6 @@ public:
10581058 std::forward<_Args>(__args)...);
10591059 }
10601060
1061- // TODO: begin
1062- template <class ... _Args>
1063- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool >
1064- __emplace_hint_unique_sfinae (true_type, const_iterator __p, _Args&&... __args) {
1065- return __emplace_hint_unique (__p, __args...);
1066- }
1067-
1068- template <class ... _Args>
1069- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool >
1070- __emplace_hint_unique_sfinae (false_type, const_iterator, _Args&&...) {
1071- // This method body should never be run. It only exists to allow for compilation. See note in
1072- // __insert_unique_from_orphaned_node for more information.
1073- return pair<iterator, bool >(iterator (__node_pointer ()), false );
1074- }
1075-
1076- template <class _ValueT = _Tp, __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0 >
1077- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1078- __insert_unique_from_orphaned_node (const_iterator __p, __get_node_value_type_t <_Tp>&& __value) {
1079- #if _LIBCPP_STD_VER >= 26
1080- if (std::is_constant_evaluated () && std::is_copy_constructible_v<decltype (__value.first )>) {
1081- // We create a sfinae wrapper method here, because if the __emplace_hint_unique method gets template instantiated
1082- // within __insert_unique_from_orphaned_node, the code will fail to compile when the value is not
1083- // copy_constructible (even for runtime execution); unless we use `if constexpr`. Given the copy-constructible
1084- // code path will be a performance regression, we want to restrict it to only execute during constant evaluation
1085- // , hence, we need to delay the template instantiation.
1086- __emplace_hint_unique_sfinae (
1087- integral_constant< bool , std::is_copy_constructible_v<decltype (__value.first )> >(),
1088- __p,
1089- __value.first ,
1090- std::move (__value.second ));
1091- } else
1092- #endif
1093- {
1094- __emplace_hint_unique (__p, const_cast <key_type&&>(__value.first ), std::move (__value.second ));
1095- }
1096- }
1097-
1098- template <class _ValueT = _Tp, __enable_if_t <!__is_tree_value_type_v<_ValueT>, int > = 0 >
1099- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1100- __insert_unique_from_orphaned_node (const_iterator __p, _Tp&& __value) {
1101- __emplace_hint_unique (__p, std::move (__value));
1102- }
1103-
1104- template <class _ValueT = _Tp, __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0 >
1105- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1106- __insert_multi_from_orphaned_node (const_iterator __p, value_type&& __value) {
1107- __emplace_hint_multi (__p, const_cast <key_type&&>(__value.first ), std::move (__value.second ));
1108- }
1109-
1110- template <class _ValueT = _Tp, __enable_if_t <!__is_tree_value_type_v<_ValueT>, int > = 0 >
1111- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1112- __insert_multi_from_orphaned_node (const_iterator __p, _Tp&& __value) {
1113- __emplace_hint_multi (__p, std::move (__value));
1114- }
1115- // TODO: end
11161061 template <class _InIter , class _Sent >
11171062 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __insert_range_multi (_InIter __first, _Sent __last) {
11181063 if (__first == __last)
@@ -1555,15 +1500,18 @@ private:
15551500#ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function
15561501 _LIBCPP_HIDE_FROM_ABI
15571502#endif
1558- _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __construct_from_tree (__node_pointer __src, _NodeConstructor __construct) {
1503+ _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer
1504+ __construct_from_tree (__node_pointer __src, _NodeConstructor __construct) {
15591505 if (!__src)
15601506 return nullptr ;
15611507
15621508 __node_holder __new_node = __construct (__src->__get_value ());
15631509
15641510 unique_ptr<__node, __tree_deleter> __left (
1565- __construct_from_tree (std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_ ), __construct), __node_alloc_);
1566- __node_pointer __right = __construct_from_tree (std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_ ), __construct);
1511+ __construct_from_tree (std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_ ), __construct),
1512+ __node_alloc_);
1513+ __node_pointer __right =
1514+ __construct_from_tree (std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_ ), __construct);
15671515
15681516 __node_pointer __new_node_ptr = __new_node.release ();
15691517
@@ -1641,19 +1589,21 @@ private:
16411589 return __dest;
16421590 }
16431591
1644- _LIBCPP_HIDE_FROM_ABI __node_pointer __copy_assign_tree (__node_pointer __dest, __node_pointer __src) {
1592+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer
1593+ __copy_assign_tree (__node_pointer __dest, __node_pointer __src) {
16451594 return __assign_from_tree (
16461595 __dest,
16471596 __src,
1648- [](value_type& __lhs, const value_type& __rhs) { __assign_value (__lhs, __rhs); },
1597+ [this ](value_type& __lhs, const value_type& __rhs) { __assign_value (__lhs, __rhs); },
16491598 [this ](__node_pointer __nd) { return __copy_construct_tree (__nd); });
16501599 }
16511600
1652- _LIBCPP_HIDE_FROM_ABI __node_pointer __move_assign_tree (__node_pointer __dest, __node_pointer __src) {
1601+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer
1602+ __move_assign_tree (__node_pointer __dest, __node_pointer __src) {
16531603 return __assign_from_tree (
16541604 __dest,
16551605 __src,
1656- [](value_type& __lhs, value_type& __rhs) { __assign_value (__lhs, std::move (__rhs)); },
1606+ [this ](value_type& __lhs, value_type& __rhs) { __assign_value (__lhs, std::move (__rhs)); },
16571607 [this ](__node_pointer __nd) { return __move_construct_tree (__nd); });
16581608 }
16591609};
0 commit comments