@@ -16,14 +16,14 @@ namespace meta {
16
16
#line 289 "reflect.h2"
17
17
class object_declaration ;
18
18
19
- #line 316 "reflect.h2"
19
+ #line 314 "reflect.h2"
20
20
}
21
21
}
22
22
23
- #line 436 "reflect.h2"
23
+ #line 434 "reflect.h2"
24
24
namespace cpp2 {
25
25
26
- #line 739 "reflect.h2"
26
+ #line 748 "reflect.h2"
27
27
}
28
28
29
29
@@ -329,17 +329,18 @@ class object_declaration
329
329
);
330
330
331
331
#line 303 "reflect.h2"
332
- public: object_declaration(object_declaration const & that);
333
-
334
332
public: [[nodiscard]] auto is_const () const -> bool;
335
333
336
334
public: [[nodiscard]] auto has_wildcard_type () const -> bool;
337
335
336
+ public: object_declaration(object_declaration const & that);
337
+
338
338
// TODO: auto get_type() const ->
339
339
340
+ #line 309 "reflect.h2"
340
341
};
341
342
342
- #line 314 "reflect.h2"
343
+ #line 312 "reflect.h2"
343
344
// =======================================================================
344
345
// Switch to Cpp1
345
346
}
@@ -478,7 +479,7 @@ namespace cpp2 {
478
479
//
479
480
auto add_virtual_destructor (meta::type_declaration& t) -> void;
480
481
481
- #line 457 "reflect.h2"
482
+ #line 455 "reflect.h2"
482
483
// -----------------------------------------------------------------------
483
484
//
484
485
// "... an abstract base class defines an interface ..."
@@ -493,7 +494,7 @@ auto add_virtual_destructor(meta::type_declaration& t) -> void;
493
494
//
494
495
auto interface (meta::type_declaration& t) -> void;
495
496
496
- #line 496 "reflect.h2"
497
+ #line 494 "reflect.h2"
497
498
// -----------------------------------------------------------------------
498
499
//
499
500
// "C.35: A base class destructor should be either public and
@@ -516,7 +517,7 @@ auto interface(meta::type_declaration& t) -> void;
516
517
//
517
518
auto polymorphic_base (meta::type_declaration& t) -> void;
518
519
519
- #line 541 "reflect.h2"
520
+ #line 539 "reflect.h2"
520
521
// -----------------------------------------------------------------------
521
522
//
522
523
// "... A totally ordered type ... requires operator<=> that
@@ -542,27 +543,27 @@ auto ordered_impl(
542
543
cpp2::in<std::string_view> ordering// must be "strong_ordering" etc.
543
544
) -> void;
544
545
545
- #line 586 "reflect.h2"
546
+ #line 584 "reflect.h2"
546
547
// -----------------------------------------------------------------------
547
548
// ordered - a totally ordered type
548
549
//
549
550
// Note: the ordering that should be encouraged as default gets the nice name
550
551
//
551
552
auto ordered (meta::type_declaration& t) -> void;
552
553
553
- #line 596 "reflect.h2"
554
+ #line 594 "reflect.h2"
554
555
// -----------------------------------------------------------------------
555
556
// weakly_ordered - a weakly ordered type
556
557
//
557
558
auto weakly_ordered (meta::type_declaration& t) -> void;
558
559
559
- #line 604 "reflect.h2"
560
+ #line 602 "reflect.h2"
560
561
// -----------------------------------------------------------------------
561
562
// partially_ordered - a partially ordered type
562
563
//
563
564
auto partially_ordered (meta::type_declaration& t) -> void;
564
565
565
- #line 613 "reflect.h2"
566
+ #line 611 "reflect.h2"
566
567
// -----------------------------------------------------------------------
567
568
//
568
569
// "A value is ... a regular type. It must have all public
@@ -575,14 +576,23 @@ auto partially_ordered(meta::type_declaration& t) -> void;
575
576
//
576
577
// -----------------------------------------------------------------------
577
578
//
579
+ // copyable
580
+ //
581
+ // A type with (copy and move) x (construction and assignment)
582
+ //
583
+ auto copyable (meta::type_declaration& t) -> void;
584
+
585
+ #line 649 "reflect.h2"
586
+ // -----------------------------------------------------------------------
587
+ //
578
588
// basic_value
579
589
//
580
- // A regular type: public default construction, copy/move construction
581
- // and assignment, and no protected or virtual functions
590
+ // A regular type: copyable, plus has public default construction
591
+ // and no protected or virtual functions
582
592
//
583
593
auto basic_value (meta::type_declaration& t) -> void;
584
594
585
- #line 666 "reflect.h2"
595
+ #line 675 "reflect.h2"
586
596
// -----------------------------------------------------------------------
587
597
//
588
598
// "A 'value' is a totally ordered basic_value..."
@@ -594,13 +604,13 @@ auto basic_value(meta::type_declaration& t) -> void;
594
604
//
595
605
auto value (meta::type_declaration& t) -> void;
596
606
597
- #line 681 "reflect.h2"
607
+ #line 690 "reflect.h2"
598
608
auto weakly_ordered_value (meta::type_declaration& t) -> void;
599
609
600
- #line 687 "reflect.h2"
610
+ #line 696 "reflect.h2"
601
611
auto partially_ordered_value (meta::type_declaration& t) -> void;
602
612
603
- #line 694 "reflect.h2"
613
+ #line 703 "reflect.h2"
604
614
// -----------------------------------------------------------------------
605
615
//
606
616
// "By definition, a `struct` is a `class` in which members
@@ -628,7 +638,7 @@ auto partially_ordered_value(meta::type_declaration& t) -> void;
628
638
//
629
639
auto cpp2_struct (meta::type_declaration& t) -> void;
630
640
631
- #line 737 "reflect.h2"
641
+ #line 746 "reflect.h2"
632
642
// =======================================================================
633
643
// Switch to Cpp1
634
644
}
@@ -671,6 +681,12 @@ auto parser::apply_type_meta_functions( declaration_node& n )
671
681
else if (meta->to_string () == " partially_ordered" ) {
672
682
partially_ordered ( rtype );
673
683
}
684
+ else if (meta->to_string () == " copyable" ) {
685
+ copyable ( rtype );
686
+ }
687
+ else if (meta->to_string () == " basic_value" ) {
688
+ basic_value ( rtype );
689
+ }
674
690
else if (meta->to_string () == " value" ) {
675
691
value ( rtype );
676
692
}
@@ -684,7 +700,7 @@ auto parser::apply_type_meta_functions( declaration_node& n )
684
700
cpp2_struct ( rtype );
685
701
}
686
702
else {
687
- error ( " (temporary alpha limitation) unrecognized metafunction name '" + meta->to_string () + " ' - currently the supported names are: interface, polymorphic_base, ordered, weakly_ordered, partially_ordered, value, weakly_ordered_value, partially_ordered_value, struct" );
703
+ error ( " (temporary alpha limitation) unrecognized metafunction name '" + meta->to_string () + " ' - currently the supported names are: interface, polymorphic_base, ordered, weakly_ordered, partially_ordered, copyable, basic_value, value, weakly_ordered_value, partially_ordered_value, struct" );
688
704
return false ;
689
705
}
690
706
}
@@ -715,30 +731,28 @@ namespace meta {
715
731
cpp2::Default.expects (CPP2_UFCS_0 (is_object, (*cpp2::assert_not_null (n))), " " );
716
732
}
717
733
718
- object_declaration::object_declaration (object_declaration const & that)
719
- : declaration{ that }
720
- #line 303 "reflect.h2"
721
- {}
722
-
723
734
[[nodiscard]] auto object_declaration::is_const () const -> bool { return CPP2_UFCS_0 (is_const, (*cpp2::assert_not_null (n))); }
724
735
725
736
[[nodiscard]] auto object_declaration::has_wildcard_type () const -> bool { return CPP2_UFCS_0 (has_wildcard_type, (*cpp2::assert_not_null (n))); }
726
737
727
- #line 316 "reflect.h2"
738
+ object_declaration::object_declaration (object_declaration const & that)
739
+ : declaration{ that }{}
740
+
741
+ #line 314 "reflect.h2"
728
742
}
729
743
}
730
744
731
- #line 436 "reflect.h2"
745
+ #line 434 "reflect.h2"
732
746
namespace cpp2 {
733
747
734
- #line 450 "reflect.h2"
748
+ #line 448 "reflect.h2"
735
749
auto add_virtual_destructor (meta::type_declaration& t) -> void
736
750
{
737
751
CPP2_UFCS (require, t, CPP2_UFCS (add_member, t, " operator=: (virtual move this) = { }" ),
738
752
" could not add virtual destructor" );
739
753
}
740
754
741
- #line 469 "reflect.h2"
755
+ #line 467 "reflect.h2"
742
756
auto interface (meta::type_declaration& t) -> void
743
757
{
744
758
auto has_dtor {false };
@@ -760,13 +774,13 @@ auto interface(meta::type_declaration& t) -> void
760
774
}
761
775
}}
762
776
763
- #line 490 "reflect.h2"
777
+ #line 488 "reflect.h2"
764
778
if (!(std::move (has_dtor))) {
765
779
add_virtual_destructor (t);
766
780
}
767
781
}
768
782
769
- #line 516 "reflect.h2"
783
+ #line 514 "reflect.h2"
770
784
auto polymorphic_base (meta::type_declaration& t) -> void
771
785
{
772
786
auto has_dtor {false };
@@ -786,13 +800,13 @@ auto polymorphic_base(meta::type_declaration& t) -> void
786
800
}
787
801
}}
788
802
789
- #line 535 "reflect.h2"
803
+ #line 533 "reflect.h2"
790
804
if (!(std::move (has_dtor))) {
791
805
add_virtual_destructor (t);
792
806
}
793
807
}
794
808
795
- #line 561 "reflect.h2"
809
+ #line 559 "reflect.h2"
796
810
auto ordered_impl (
797
811
meta::type_declaration& t,
798
812
cpp2::in<std::string_view> ordering
@@ -812,33 +826,33 @@ auto ordered_impl(
812
826
}
813
827
}}
814
828
815
- #line 580 "reflect.h2"
829
+ #line 578 "reflect.h2"
816
830
if (!(std::move (has_spaceship))) {
817
831
CPP2_UFCS (require, t, CPP2_UFCS (add_member, t, " operator<=>: (this, that) -> std::" + (cpp2::as_<std::string>(ordering)) + " ;" ),
818
832
" could not add operator<=> with std::" + (cpp2::as_<std::string>(ordering)));
819
833
}
820
834
}
821
835
822
- #line 591 "reflect.h2"
836
+ #line 589 "reflect.h2"
823
837
auto ordered (meta::type_declaration& t) -> void
824
838
{
825
839
ordered_impl (t, " strong_ordering" );
826
840
}
827
841
828
- #line 599 "reflect.h2"
842
+ #line 597 "reflect.h2"
829
843
auto weakly_ordered (meta::type_declaration& t) -> void
830
844
{
831
845
ordered_impl (t, " weak_ordering" );
832
846
}
833
847
834
- #line 607 "reflect.h2"
848
+ #line 605 "reflect.h2"
835
849
auto partially_ordered (meta::type_declaration& t) -> void
836
850
{
837
851
ordered_impl (t, " partial_ordering" );
838
852
}
839
853
840
- #line 630 "reflect.h2"
841
- auto basic_value (meta::type_declaration& t) -> void
854
+ #line 627 "reflect.h2"
855
+ auto copyable (meta::type_declaration& t) -> void
842
856
{
843
857
// If the user explicitly wrote any of the copy/move functions,
844
858
// they must also have written the most general one - we can't
@@ -858,6 +872,12 @@ auto basic_value(meta::type_declaration& t) -> void
858
872
CPP2_UFCS (require, t, CPP2_UFCS (add_member, t, " operator=: (out this, that) = { }" ),
859
873
" could not add general operator=:(out this, that)" );
860
874
}}
875
+ }
876
+
877
+ #line 656 "reflect.h2"
878
+ auto basic_value (meta::type_declaration& t) -> void
879
+ {
880
+ copyable (t);
861
881
862
882
auto has_default_ctor {false };
863
883
{ auto && cpp2_range = CPP2_UFCS_0 (get_member_functions, t); for ( auto & mf : cpp2_range ) {
@@ -868,14 +888,14 @@ auto basic_value(meta::type_declaration& t) -> void
868
888
" a value type may not have a non-public destructor" );
869
889
}}
870
890
871
- #line 660 "reflect.h2"
891
+ #line 669 "reflect.h2"
872
892
if (!(std::move (has_default_ctor))) {
873
893
CPP2_UFCS (require, t, CPP2_UFCS (add_member, t, " operator=: (out this) = { }" ),
874
894
" could not add default constructor" );
875
895
}
876
896
}
877
897
878
- #line 675 "reflect.h2"
898
+ #line 684 "reflect.h2"
879
899
auto value (meta::type_declaration& t) -> void
880
900
{
881
901
ordered (t);
@@ -894,7 +914,7 @@ auto partially_ordered_value(meta::type_declaration& t) -> void
894
914
basic_value (t);
895
915
}
896
916
897
- #line 719 "reflect.h2"
917
+ #line 728 "reflect.h2"
898
918
auto cpp2_struct (meta::type_declaration& t) -> void
899
919
{
900
920
{ auto && cpp2_range = CPP2_UFCS_0 (get_members, t); for ( auto & m : cpp2_range )
@@ -909,11 +929,11 @@ auto cpp2_struct(meta::type_declaration& t) -> void
909
929
" a struct may not have a user-defined operator=" );
910
930
}
911
931
}}
912
- #line 733 "reflect.h2"
932
+ #line 742 "reflect.h2"
913
933
basic_value (t); // a plain_struct is-a basic_value
914
934
}
915
935
916
- #line 739 "reflect.h2"
936
+ #line 748 "reflect.h2"
917
937
}
918
938
919
939
#endif
0 commit comments