@@ -1053,11 +1053,11 @@ public:
1053
1053
#if _LIBCPP_STD_VER >= 26
1054
1054
if (__libcpp_is_constant_evaluated ()) {
1055
1055
// static_assert(std::same_as_v<decltype(__value.first), double>);
1056
- // __emplace_hint_unique(__p, std::move(__value.first), std::move(__value.second));
1056
+ __emplace_hint_unique (__p, std::move (__value.first ), std::move (__value.second ));
1057
1057
1058
- __sfinae_call_emplace_hint_unique (__p, std::move (__value),
1059
- integral_constant<bool , is_copy_constructible<decltype (__value.first )>::value >()
1060
- );
1058
+ // __sfinae_call_emplace_hint_unique(__p, std::move(__value),
1059
+ // integral_constant<bool, is_copy_constructible<decltype(__value.first)>::value >()
1060
+ // );
1061
1061
} else
1062
1062
#endif
1063
1063
{
@@ -1239,30 +1239,66 @@ private:
1239
1239
1240
1240
1241
1241
// todo; mark consteval?
1242
- #ifdef FAKE_VINAY
1242
+ // #ifdef FAKE_VINAY
1243
1243
1244
1244
template <class _From , class _ValueT = _Tp,
1245
1245
__enable_if_t <__is_tree_value_type<_ValueT>::value, int > = 0
1246
- , __enable_if_t < ! is_copy_constructible_v< typename _From::first_type >, int > = 0
1246
+
1247
+ // , typename = std::enable_if_t<
1248
+ // !std::is_copy_constructible_v<
1249
+ // std::remove_cvref_t<decltype(std::declval<_From>().first)>
1250
+ // >
1251
+ // >
1247
1252
>
1253
+ requires (!std::is_copy_constructible_v<
1254
+ std::remove_cvref_t <decltype (std::declval<_From>().first)>
1255
+ >)
1248
1256
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_from_value_type (
1249
1257
__get_node_value_type_t <value_type>& __lhs, _From&& __rhs/* , false_type*/ ) _NOEXCEPT {
1250
1258
(void )__lhs;
1251
1259
(void )__rhs;
1252
- static_assert (false , " Can not move from a pair<const T, T>" );
1260
+ // static_assert(false, "Can not move from a pair<const T, U>");
1261
+ // TODO: how do I flag this code to NOT run at compile time?
1262
+ // Using static_assert means this can't compile _at all_, regardless of whether this code is actually going to execute at compile time or not
1253
1263
}
1254
1264
1255
1265
template <class _From , class _ValueT = _Tp,
1256
1266
__enable_if_t <__is_tree_value_type<_ValueT>::value, int > = 0
1257
1267
1258
1268
// Check if first type can be copy constructed
1259
- , __enable_if_t < is_copy_constructible_v< typename _From::first_type >, int > = 0
1269
+
1270
+ // , typename = std::enable_if_t<
1271
+ // std::is_copy_constructible_v<
1272
+ // std::remove_cvref_t<decltype(std::declval<_From>().first)>
1273
+ // >
1274
+ // >
1260
1275
>
1276
+ requires ( std::is_copy_constructible_v<
1277
+ std::remove_cvref_t <decltype (std::declval<_From>().first)>
1278
+ >)
1261
1279
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_from_value_type (
1262
1280
__get_node_value_type_t <value_type>& __lhs, _From&& __rhs/* , true_type*/ ) _NOEXCEPT {
1263
1281
1282
+
1283
+ // const_cast is not allowed at constexpr time.
1284
+ // 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
1288
+
1289
+
1290
+ __node_allocator& __na = __node_alloc ();
1291
+ __node_traits::destroy (__na, std::addressof (__lhs));
1292
+
1293
+ // __get_node_value_type_t<value_type> __tmp(__rhs);
1294
+ using __node_value_type = __get_node_value_type_t <value_type>;
1295
+ __get_node_value_type_t <value_type> __tmp (__rhs.first , __rhs.second );
1296
+ __node_traits::construct (__na, std::addressof (__lhs), std::move (__tmp));
1297
+
1298
+
1299
+
1264
1300
}
1265
- #endif
1301
+ // #endif
1266
1302
1267
1303
1268
1304
@@ -1280,25 +1316,9 @@ error: no matching constructor for initialization of '__get_node_value_type_t<va
1280
1316
# | 1225 | __get_node_value_type_t<value_type> __tmp(__rhs.first, __rhs.second);
1281
1317
*/
1282
1318
if (__libcpp_is_constant_evaluated ()) {
1283
- // __move_from_value_type(__lhs, __rhs
1319
+ __move_from_value_type (__lhs, __rhs
1284
1320
// , integral_constant<bool, is_copy_constructible_v<_From> >()
1285
- // );
1286
-
1287
- using __node_value_type = __get_node_value_type_t <value_type>;
1288
- __get_node_value_type_t <value_type> __tmp (__rhs.first , __rhs.second );
1289
- // __get_node_value_type_t<value_type> __tmp(__rhs);
1290
-
1291
- // const_cast is not allowed at constexpr time.
1292
- // we get around this by deleting __lhs and creating a new node in-place
1293
- // to avoid const_cast -ing __lhs.first
1294
-
1295
- // note: this does not work for `const MoveOnly` keys at constexpr time
1296
-
1297
- // __lhs.~__node_value_type();
1298
- __node_allocator& __na = __node_alloc ();
1299
- __node_traits::destroy (__na, std::addressof (__lhs));
1300
- __node_traits::construct (__na, std::addressof (__lhs), std::move (__tmp));
1301
-
1321
+ );
1302
1322
1303
1323
1304
1324
0 commit comments