@@ -569,7 +569,7 @@ auto basic_value(meta::type_declaration& t) -> void;
569
569
// -----------------------------------------------------------------------
570
570
//
571
571
// "A 'value' is a totally ordered basic_value..."
572
- //
572
+ //
573
573
// -- P0707R4, section 3
574
574
//
575
575
// value - a value type that is totally ordered
@@ -649,20 +649,20 @@ auto basic_enum(
649
649
// value of its enumerators's type, and otherwise has only public
650
650
// member variables of its enumerator's type, all of which are
651
651
// naturally scoped because they are members of a type."
652
- //
652
+ //
653
653
// -- P0707R4, section 3
654
654
//
655
655
auto cpp2_enum (meta::type_declaration& t) -> void;
656
656
657
657
#line 1048 "reflect.h2"
658
658
// -----------------------------------------------------------------------
659
659
//
660
- // "flag_enum expresses an enumeration that stores values
660
+ // "flag_enum expresses an enumeration that stores values
661
661
// corresponding to bitwise-or'd enumerators. The enumerators must
662
662
// be powers of two, and are automatically generated [...] A none
663
663
// value is provided [...] Operators | and & are provided to
664
664
// combine and extract values."
665
- //
665
+ //
666
666
// -- P0707R4, section 3
667
667
//
668
668
auto flag_enum (meta::type_declaration& t) -> void;
@@ -676,10 +676,10 @@ auto flag_enum(meta::type_declaration& t) -> void;
676
676
//
677
677
// -- Stroustrup (The Design and Evolution of C++, 14.3.4.1)
678
678
//
679
- // "C++17 needs a type-safe union... The implications of the
680
- // consensus `variant` design are well understood and have been
681
- // explored over several LEWG discussions, over a thousand emails,
682
- // a joint LEWG/EWG session, and not to mention 12 years of
679
+ // "C++17 needs a type-safe union... The implications of the
680
+ // consensus `variant` design are well understood and have been
681
+ // explored over several LEWG discussions, over a thousand emails,
682
+ // a joint LEWG/EWG session, and not to mention 12 years of
683
683
// experience with Boost and other libraries."
684
684
//
685
685
// -- Axel Naumann, in P0088 (wg21.link/p0088),
@@ -688,9 +688,9 @@ auto flag_enum(meta::type_declaration& t) -> void;
688
688
// -----------------------------------------------------------------------
689
689
//
690
690
// union
691
- //
691
+ //
692
692
// a type that contains exactly one of a fixed set of values at a time
693
- //
693
+ //
694
694
695
695
auto cpp2_union (meta::type_declaration& t) -> void;
696
696
@@ -790,9 +790,7 @@ auto newline_pos = CPP2_UFCS(find)(source, '\n');
790
790
newline_pos = CPP2_UFCS (find)(source, ' \n ' );
791
791
}
792
792
}
793
- }
794
793
795
- #line 99 "reflect.h2"
796
794
if (!(CPP2_UFCS (empty)(source))) {
797
795
std::move (add_line)(std::move (source));
798
796
}
@@ -812,6 +810,8 @@ auto newline_pos = CPP2_UFCS(find)(source, '\n');
812
810
(*cpp2::assert_not_null (CPP2_UFCS (begin)(CPP2_UFCS (get_map)(*cpp2::assert_not_null (std::move (tokens)))))).second ,
813
811
*cpp2::assert_not_null (generated_tokens)
814
812
);
813
+ }
814
+ #line 118 "reflect.h2"
815
815
}
816
816
817
817
[[nodiscard]] auto compiler_services::position () const -> source_position
@@ -835,7 +835,7 @@ auto newline_pos = CPP2_UFCS(find)(source, '\n');
835
835
{
836
836
auto message {cpp2::as_<std::string>(msg)};
837
837
if (!(CPP2_UFCS (empty)(metafunction_name))) {
838
- message = " while applying @" + metafunction_name + " - " + message;
838
+ message = " while applying @" + metafunction_name + " - " + std::move ( message) ;
839
839
}
840
840
static_cast <void >(CPP2_UFCS (emplace_back)((*cpp2::assert_not_null (errors)), position (), std::move (message)));
841
841
}
@@ -1360,7 +1360,7 @@ auto basic_enum(
1360
1360
std::vector<value_member_info> enumerators {};
1361
1361
cpp2::i64 min_value {};
1362
1362
cpp2::i64 max_value {};
1363
- cpp2::deferred_init< std::string> underlying_type;
1363
+ std::string underlying_type {} ;
1364
1364
1365
1365
CPP2_UFCS (reserve_names)(t, " operator=" , " operator<=>" );
1366
1366
if (bitwise) {
@@ -1369,7 +1369,7 @@ auto basic_enum(
1369
1369
1370
1370
// 1. Gather: The names of all the user-written members, and find/compute the type
1371
1371
1372
- underlying_type. construct ( CPP2_UFCS (get_argument)(t, 0 ) );// use the first template argument, if there was one
1372
+ underlying_type = CPP2_UFCS (get_argument)(t, 0 );// use the first template argument, if there was one
1373
1373
1374
1374
auto found_non_numeric {false };
1375
1375
{
@@ -1415,23 +1415,23 @@ std::string value = "-1";
1415
1415
1416
1416
// Compute the default underlying type, if it wasn't explicitly specified
1417
1417
#line 913 "reflect.h2"
1418
- if (underlying_type. value () == " " )
1418
+ if (underlying_type == " " )
1419
1419
{
1420
1420
CPP2_UFCS (require)(t, !(std::move (found_non_numeric)),
1421
1421
" if you write an enumerator with a non-numeric-literal value, you must specify the enumeration's underlying type" );
1422
1422
1423
1423
if (!(bitwise)) {
1424
1424
if (cpp2::cmp_greater_eq (min_value,std::numeric_limits<cpp2::i8 >::min ()) && cpp2::cmp_less_eq (max_value,std::numeric_limits<cpp2::i8 >::max ())) {
1425
- underlying_type. value () = " i8" ;
1425
+ underlying_type = " i8" ;
1426
1426
}
1427
1427
else {if (cpp2::cmp_greater_eq (min_value,std::numeric_limits<cpp2::i16 >::min ()) && cpp2::cmp_less_eq (max_value,std::numeric_limits<cpp2::i16 >::max ())) {
1428
- underlying_type. value () = " i16" ;
1428
+ underlying_type = " i16" ;
1429
1429
}
1430
1430
else {if (cpp2::cmp_greater_eq (min_value,std::numeric_limits<cpp2::i32 >::min ()) && cpp2::cmp_less_eq (max_value,std::numeric_limits<cpp2::i32 >::max ())) {
1431
- underlying_type. value () = " i32" ;
1431
+ underlying_type = " i32" ;
1432
1432
}
1433
- else {if (cpp2::cmp_greater_eq (std::move (min_value),std::numeric_limits<cpp2::i64 >::min ()) && cpp2::cmp_less_eq (max_value,std::numeric_limits<cpp2::i64 >::max ())) {
1434
- underlying_type. value () = " i64" ;
1433
+ else {if (cpp2::cmp_greater_eq (std::move (min_value),std::numeric_limits<cpp2::i64 >::min ()) && cpp2::cmp_less_eq (std::move ( max_value) ,std::numeric_limits<cpp2::i64 >::max ())) {
1434
+ underlying_type = " i64" ;
1435
1435
}
1436
1436
else {
1437
1437
CPP2_UFCS (error)(t, " values are outside the range representable by the largest supported underlying signed type (i64)" );
@@ -1440,16 +1440,16 @@ std::string value = "-1";
1440
1440
else {
1441
1441
auto umax {std::move (max_value) * cpp2::as_<cpp2::u64 , 2 >()};
1442
1442
if (cpp2::cmp_less_eq (umax,std::numeric_limits<cpp2::u8 >::max ())) {
1443
- underlying_type. value () = " u8" ;
1443
+ underlying_type = " u8" ;
1444
1444
}
1445
1445
else {if (cpp2::cmp_less_eq (umax,std::numeric_limits<cpp2::u16 >::max ())) {
1446
- underlying_type. value () = " u16" ;
1446
+ underlying_type = " u16" ;
1447
1447
}
1448
1448
else {if (cpp2::cmp_less_eq (std::move (umax),std::numeric_limits<cpp2::u32 >::max ())) {
1449
- underlying_type. value () = " u32" ;
1449
+ underlying_type = " u32" ;
1450
1450
}
1451
1451
else {
1452
- underlying_type. value () = " u64" ;
1452
+ underlying_type = " u64" ;
1453
1453
}}}
1454
1454
}
1455
1455
}
@@ -1462,9 +1462,9 @@ std::string value = "-1";
1462
1462
CPP2_UFCS (remove_marked_members)(t);
1463
1463
1464
1464
// Generate all the common material: value and common functions
1465
- CPP2_UFCS (add_member)(t, " _value : " + cpp2::to_string (underlying_type. value () ) + " ;" );
1466
- CPP2_UFCS (add_member)(t, " private operator= : (implicit out this, _val: i64) == _value = cpp2::unsafe_narrow<" + cpp2::to_string (underlying_type. value () ) + " >(_val);" );
1467
- CPP2_UFCS (add_member)(t, " get_raw_value : (this) -> " + cpp2::to_string (std::move (underlying_type. value () )) + " == _value;" );
1465
+ CPP2_UFCS (add_member)(t, " _value : " + cpp2::to_string (underlying_type) + " ;" );
1466
+ CPP2_UFCS (add_member)(t, " private operator= : (implicit out this, _val: i64) == _value = cpp2::unsafe_narrow<" + cpp2::to_string (underlying_type) + " >(_val);" );
1467
+ CPP2_UFCS (add_member)(t, " get_raw_value : (this) -> " + cpp2::to_string (std::move (underlying_type)) + " == _value;" );
1468
1468
CPP2_UFCS (add_member)(t, " operator= : (out this, that) == { }" );
1469
1469
CPP2_UFCS (add_member)(t, " operator<=> : (this, that) -> std::strong_ordering;" );
1470
1470
0 commit comments