#include #include #include using namespace std; // struct S { char s[32]; }; // variant< int, double, S > vd; // variant< int, int, int > vs; // int main() { // cout << "sizeof vd " << sizeof( vd ) << endl; // vd = 3; // if ( holds_alternative(vd) ) cout << "int " << get(vd ) << endl; // vd = 3.5; // if ( holds_alternative(vd) ) cout << "double " << get(vd) << endl; // vd = (S){ "abc" }; // if ( holds_alternative(vd) ) cout << "S.s " << get(vd).s << endl; // cout << "sizeof vs " << sizeof( vs ) << endl; // vs = (variant){ in_place_index<0>, 12 }; // if ( vs.index() == 0 ) cout << "posn 0 " << get<0>(vs) << endl; // vs = (variant){ in_place_index<1>, 4 }; // if ( vs.index() == 1 ) cout << "posn 1 " << get<1>(vs) << endl; // vs = (variant){ in_place_index<2>, 5 }; // if ( vs.index() == 2 ) cout << "posn 2 " << get<2>(vs) << endl; // } constexpr auto one = 0 + 1; const auto NUL = nullptr; const auto PI = 3.14159; const auto Plus = '+'; const auto Fred = "Fred"; const auto Mon = 0, Tue = Mon + 1, Wed = Tue + 1, Thu = Wed + 1, Fri = Thu + 1, Sat = Fri + 1, Sun = Sat + 1; const auto r = random(); enum E { A, B, C }; enum class EC : long { A, B, C }; int a1[Sun + 1], a2[C + 1]; int main() { const auto one = random(); // const int * ip = &one; int sa[Sun]; int * i = NUL; E e; // switch ( e ) { // case w: ; // } switch ( e ) { case Sat: ; } switch ( e ) { case C: ; } EC ec; switch ( ec ) { case EC::A: ; } EC eca[C]; eca[A] = EC::A; enum Week { Mon, Tue, Wed, Thu = 10, Fri, Sat, Sun }; Week day = Mon; if ( day <= Fri ) cout << "weekday" << endl; switch ( day ) { case Mon: case Tue: case Wed: case Thu: case Fri: cout << "weekday" << endl; break; case Sat: case Sun: cout << "weekend" << endl; break; } for ( Week d = Mon; d <= Sun; d = (Week)(d + 1) ) { cout << d << ' '; } cout << endl; } // Local Variables: // // compile-command: "g++ -std=c++17 test.cc" // // End: //