@@ -999,39 +999,9 @@ public:
999
999
return __emplace_hint_unique_key_args (__p, __x.first , std::forward<_Pp>(__x)).first ;
1000
1000
}
1001
1001
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
-
1031
1002
template <class _ValueT = _Tp, __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0 >
1032
1003
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1033
1004
__insert_unique_from_orphaned_node (const_iterator __p, __get_node_value_type_t <_Tp>&& __value) {
1034
- // fails here for move_alloc.pass.cpp
1035
1005
1036
1006
#if _LIBCPP_STD_VER >= 26
1037
1007
if constexpr (
@@ -1214,66 +1184,16 @@ private:
1214
1184
}
1215
1185
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc (__tree&, false_type) _NOEXCEPT {}
1216
1186
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
-
1260
1187
template <class _From , class _ValueT = _Tp, __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0 >
1261
1188
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __assign_value (__get_node_value_type_t <value_type>& __lhs, _From&& __rhs) {
1262
1189
using __key_type = __remove_const_t <typename value_type::first_type>;
1263
1190
1264
1191
1265
1192
#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
- */
1272
1193
1273
1194
if constexpr (
1274
1195
integral_constant<bool , is_copy_constructible<decltype (__rhs.first )>::value >()
1275
1196
){
1276
- // if constexpr (integral_constant<bool, is_copy_constructible_v<_From> >()) {
1277
1197
// we use copy, and not "move" as the constraint
1278
1198
// because we can NOT move from `const key_type`, which is how `value_type` is defined
1279
1199
// atleast for map
@@ -1282,19 +1202,19 @@ error: no matching constructor for initialization of '__get_node_value_type_t<va
1282
1202
1283
1203
// const_cast is not allowed at constexpr time.
1284
1204
// 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
1288
1206
1289
1207
__node_allocator& __na = __node_alloc ();
1290
1208
__node_traits::destroy (__na, std::addressof (__lhs));
1291
1209
1292
- // __get_node_value_type_t<value_type> __tmp(__rhs);
1293
1210
using __node_value_type = __get_node_value_type_t <value_type>;
1294
1211
__node_value_type __tmp (__rhs.first , __rhs.second );
1212
+
1213
+
1295
1214
__node_traits::construct (__na, std::addressof (__lhs), std::move (__tmp));
1296
1215
1297
1216
1217
+
1298
1218
} else
1299
1219
#endif
1300
1220
{
0 commit comments