fork(2) download
  1. #include <iostream>
  2.  
  3. template<unsigned A>
  4. struct Wrapper {
  5. int content[A];
  6. void foo() { };
  7. };
  8.  
  9. #define WRAPPER_SWITCH_CASE(i) case i: Wrapper<i>().foo(); break;
  10.  
  11. int main(int argc, char *argv[])
  12. {
  13. std::string arg = /*argv[1]*/"2"; // ...because here is online compiler >o<
  14. int arg_int = std::stoi(arg);
  15.  
  16. switch (arg_int) {
  17. WRAPPER_SWITCH_CASE(1)
  18. WRAPPER_SWITCH_CASE(2)
  19. WRAPPER_SWITCH_CASE(3)
  20. default: return 1;
  21. };
  22.  
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 3424KB
stdin
Standard input is empty
stdout
Standard output is empty