@@ -999,39 +999,9 @@ public:
999999 return __emplace_hint_unique_key_args (__p, __x.first , std::forward<_Pp>(__x)).first ;
10001000 }
10011001
1002- template <
1003- class _ValueT = _Tp,
1004- __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0
1005- >
1006- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1007- __sfinae_call_emplace_hint_unique (const_iterator __p, __get_node_value_type_t <_Tp>&& __value, false_type) {
1008- // TODO:
1009- // Using sfinae was thought to be needed, to avoid "instantiation" of a copy constructor
1010- // but that original idea fell through, so these __sfinae_* overloads could very likely be collpased into
1011- // if constexpr {...} else {...} anyway.
1012-
1013- // __emplace_hint_unique(__p, std::move(__value.first), std::move(__value.second));
1014- // static_assert(false, "Can not emplace during constant evaluation if the key is `const MoveOnly` ");
1015- // TODO: somehow flag this code if it executes during compile time
1016-
1017- (void )__p;
1018- (void )__value;
1019- }
1020-
1021- template <
1022- class _ValueT = _Tp,
1023- __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0
1024- >
1025- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1026- __sfinae_call_emplace_hint_unique (const_iterator __p, __get_node_value_type_t <_Tp>&& __value, true_type) {
1027- __emplace_hint_unique (__p, std::move (__value.first ), std::move (__value.second ));
1028- }
1029-
1030-
10311002 template <class _ValueT = _Tp, __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0 >
10321003 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
10331004 __insert_unique_from_orphaned_node (const_iterator __p, __get_node_value_type_t <_Tp>&& __value) {
1034- // fails here for move_alloc.pass.cpp
10351005
10361006 #if _LIBCPP_STD_VER >= 26
10371007 if constexpr (
@@ -1214,66 +1184,16 @@ private:
12141184 }
12151185 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc (__tree&, false_type) _NOEXCEPT {}
12161186
1217-
1218- // todo; remove
1219- #ifdef FAKE_VINAY
1220-
1221- template <class _From , class _ValueT = _Tp,
1222- __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0
1223-
1224- , typename = std::enable_if_t <
1225- !std::is_copy_constructible_v<
1226- std::remove_cvref_t <decltype (std::declval<_From>().first)>
1227- >
1228- >
1229- >
1230- // requires (!std::is_copy_constructible_v<
1231- // std::remove_cvref_t<decltype(std::declval<_From>().first)>
1232- // >)
1233- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_from_value_type (
1234- __get_node_value_type_t <value_type>& __lhs, _From&& __rhs/* , false_type*/ ) _NOEXCEPT {
1235- }
1236-
1237- template <class _From , class _ValueT = _Tp,
1238- __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0
1239-
1240- // Check if first type can be copy constructed
1241-
1242- , typename = std::enable_if_t <
1243- std::is_copy_constructible_v<
1244- std::remove_cvref_t <decltype (std::declval<_From>().first)>
1245- >
1246- >
1247- >
1248- // requires ( std::is_copy_constructible_v<
1249- // std::remove_cvref_t<decltype(std::declval<_From>().first)>
1250- // >)
1251- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_from_value_type (
1252- __get_node_value_type_t <value_type>& __lhs, _From&& __rhs/* , true_type*/ ) _NOEXCEPT {
1253-
1254-
1255- }
1256- #endif
1257-
1258-
1259-
12601187 template <class _From , class _ValueT = _Tp, __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0 >
12611188 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __assign_value (__get_node_value_type_t <value_type>& __lhs, _From&& __rhs) {
12621189 using __key_type = __remove_const_t <typename value_type::first_type>;
12631190
12641191
12651192 #if _LIBCPP_STD_VER >= 26
1266- // TODO: also add SFINAE to prevent move_assign and move_alloc from instantiating this code
1267- // because of
1268- /*
1269- error: no matching constructor for initialization of '__get_node_value_type_t<value_type>' (aka 'std::pair<const MoveOnly, MoveOnly>')
1270- # | 1225 | __get_node_value_type_t<value_type> __tmp(__rhs.first, __rhs.second);
1271- */
12721193
12731194 if constexpr (
12741195 integral_constant<bool , is_copy_constructible<decltype (__rhs.first )>::value >()
12751196 ){
1276- // if constexpr (integral_constant<bool, is_copy_constructible_v<_From> >()) {
12771197 // we use copy, and not "move" as the constraint
12781198 // because we can NOT move from `const key_type`, which is how `value_type` is defined
12791199 // atleast for map
@@ -1282,19 +1202,19 @@ error: no matching constructor for initialization of '__get_node_value_type_t<va
12821202
12831203 // const_cast is not allowed at constexpr time.
12841204 // we get around this by deleting __lhs and creating a new node in-place
1285- // to avoid const_cast -ing __lhs.first
1286-
1287- // note: this does not work for `const MoveOnly` keys at constexpr time
1205+ // to avoid const_cast __lhs.first
12881206
12891207 __node_allocator& __na = __node_alloc ();
12901208 __node_traits::destroy (__na, std::addressof (__lhs));
12911209
1292- // __get_node_value_type_t<value_type> __tmp(__rhs);
12931210 using __node_value_type = __get_node_value_type_t <value_type>;
12941211 __node_value_type __tmp (__rhs.first , __rhs.second );
1212+
1213+
12951214 __node_traits::construct (__na, std::addressof (__lhs), std::move (__tmp));
12961215
12971216
1217+
12981218 } else
12991219 #endif
13001220 {
0 commit comments