Last active
November 21, 2017 15:53
Revisions
-
SethHamilton revised this gist
Nov 21, 2017 . No changes.There are no files selected for viewing
-
SethHamilton revised this gist
Nov 21, 2017 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ #pragma once #include <unordered_map> #include <utility> enum class test_e : int64_t { one, -
SethHamilton created this gist
Nov 21, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ enum class test_e : int64_t { one, two, three }; // forward map static const std::unordered_map<string, test_e> testForwardMap = { {"one", test_e::one}, {"two", test_e::two}, {"three", test_e::three} }; // reverse map static const std::unordered_map<test_e, string> testReverseMap([]()->std::unordered_map<test_e,string>{ std::unordered_map<test_e, string> res; for (auto &i : testForwardMap) res.emplace(i.second, i.first); return std::move(res); }());