7 #include "DefaultMethods.h"
9 #include "PointerToMember.h"
10 #include "FunctionsAsTemplate.h"
11 #include "CostOfUsingStatic.h"
12 #include "TemplateMetaProgramming.h"
13 #include "NextAndExchange.h"
15 #include "ConstexprIf.h"
16 #include "FoldExpressions.h"
17 #include "IfAndSwitchInitStatements.h"
18 #include "AggregateInitializations.h"
19 #include "VariadicUsing.h"
20 #include "VariadicTemplates.h"
22 #include "ReadVarint.h"
25 constexpr auto DEFAULT_METHODS_ENABLED
= false;
26 constexpr auto TRAITS_ENABLED
= false;
27 constexpr auto POINTER_TO_MEMBER
= false;
28 constexpr auto FUNCTIONS_AS_TEMPLATE
= false;
29 constexpr auto COST_OF_USING_STATIC
= false;
30 constexpr auto TEMPLATE_METAPROGRAMMING
= false;
31 constexpr auto NEXT_AND_EXCHANGE
= false;
32 constexpr auto BIND
= false;
33 constexpr auto CONSTEXPR_IF
= false;
34 constexpr auto FOLD_EXPRESSIONS
= false;
35 constexpr auto IF_AND_SWITCH_INIT_STATEMENTS
= false;
36 constexpr auto AGGREGATE_INITIALIZATIONS
= false;
37 constexpr auto VARIADIC_USING
= false;
38 constexpr auto VARIADIC_TEMPLATES
= false;
39 constexpr auto LAMBDAS
= false;
40 constexpr auto READ_VARINT
= false;
41 constexpr auto CONCEPTS
= true;
48 // Forbid to be called with char or float (automatic conversion to 'int').
49 bool isLucky(char) = delete;
50 bool isLucky(double) = delete;
60 // Do not forget that 'endl' call 'flush' as well. Never use 'endl' when writing a lot of data (into a file for example).
61 cout
<< "Sandbox C++" << endl
;
62 cout
<< "-----------" << endl
;
64 auto startTime
= chrono::steady_clock::now();
66 if constexpr (DEFAULT_METHODS_ENABLED
)
67 DefaultMethods::tests();
69 if constexpr (TRAITS_ENABLED
)
72 if constexpr (POINTER_TO_MEMBER
)
73 PointerToMember::tests();
75 if constexpr (FUNCTIONS_AS_TEMPLATE
)
76 FunctionsAsTemplate::tests();
78 if constexpr (COST_OF_USING_STATIC
)
79 CostOfUsingStatic::tests();
81 if constexpr (TEMPLATE_METAPROGRAMMING
)
82 TemplateMetaProgramming::tests();
84 if constexpr (NEXT_AND_EXCHANGE
)
85 NextAndExchange::tests();
90 if constexpr (CONSTEXPR_IF
)
93 if constexpr (FOLD_EXPRESSIONS
)
94 FoldExpressions::tests();
96 if constexpr (IF_AND_SWITCH_INIT_STATEMENTS
)
97 IfAndSwitchInitStatements::tests();
99 if constexpr (AGGREGATE_INITIALIZATIONS
)
100 AggregateInitializations::tests();
102 if constexpr (VARIADIC_USING
)
103 VariadicUsing::tests();
105 if constexpr (VARIADIC_TEMPLATES
)
106 VariadicTemplates::tests();
108 if constexpr (LAMBDAS
)
111 if constexpr (READ_VARINT
)
114 if constexpr (CONCEPTS
)
117 auto endTime
= chrono::steady_clock::now();
119 cout
<< "-----------" << endl
;
120 cout
<< "Elapsed time: " << chrono::duration_cast
<chrono::milliseconds
>(endTime
- startTime
).count() << " ms" << endl
;
123 cout << "Press ENTER to quit" << endl;