fork(1) download
  1. #include <map>
  2. #include <string>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. enum class ID_Color {
  8. RED, BLUE, WHITE
  9. };
  10.  
  11. inline string Foo(ID_Color color){
  12. static const map<ID_Color, string> colorsMap = {
  13. {ID_Color::RED, "czerwony"}, {ID_Color::BLUE, "niebieski"}, {ID_Color::WHITE, "biały"}
  14. };
  15. return colorsMap.at(color);
  16. }
  17.  
  18. int main(){
  19. cout << Foo(ID_Color::RED) << endl;
  20. return 0;
  21. }
Compilation error #stdin compilation error #stdout 0s 3276KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'std::string Foo(ID_Color)':
prog.cpp:12:18: error: 'unordered_map' does not name a type
     static const unordered_map<ID_Color, string> colorsMap = { 
                  ^
prog.cpp:15:12: error: 'colorsMap' was not declared in this scope
     return colorsMap.at(color);
            ^
stdout
Standard output is empty