fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <unordered_map>
  4.  
  5. class Test
  6. {
  7. public:
  8.  
  9. enum class Index
  10. {
  11. three = 3,
  12. six = 6
  13. };
  14.  
  15. struct HashIndex
  16. {
  17. size_t operator()(Index index) const { return (size_t)index; }
  18. };
  19.  
  20. private:
  21. static const std::unordered_map<Index,std::string,HashIndex> m;
  22. };
  23.  
  24.  
  25. const std::unordered_map<Test::Index,std::string,Test::HashIndex>
  26. m = {
  27. {Test::Index::three, "three" },
  28. {Test::Index::six, "six" }
  29. };
  30.  
  31. int main() {
  32. // your code goes here
  33. return 0;
  34. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Standard output is empty