fork download
  1. // Example program
  2. #include <iostream>
  3. #include <string>
  4. #include <map>
  5.  
  6.  
  7. class Input
  8. {
  9. public:
  10. Input(const std::map<std::string, void(*)(void)> &arg_0)
  11. { /*...code...*/ }
  12. };
  13.  
  14. class Main
  15. {
  16. private:
  17. //WORKS
  18. Input _Input_0(
  19. std::map<std::string, void(*)(void)> NAME = {
  20. {"exit", [](){exit(1);}}
  21. }
  22. );
  23. //Doesn't Work
  24. Input _Input_1(
  25. std::map<std::string, void(*)(void)> {
  26. {"exit", [](){exit(1);}}
  27. }
  28. );
  29. };
  30.  
  31. int main()
  32. {
  33. //WORKS
  34. Input _Input(
  35. std::map<std::string, void(*)(void)> {
  36. {"exit", [](){exit(1);}}
  37. }
  38. );
  39.  
  40. //Doesn't Work
  41. Main _Main;
  42. }
  43.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:25:46: error: expected ')' before '{' token
         std::map<std::string, void(*)(void)> {
                                              ^
prog.cpp:28:5: error: expected unqualified-id before ')' token
     );  
     ^
prog.cpp: In member function 'Input Main::_Input_1(std::map<std::basic_string<char>, void (*)()>)':
prog.cpp:26:36: error: expected ';' before '}' token
             {"exit", [](){exit(1);}}
                                    ^
stdout
Standard output is empty