Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string enumToString1(Enum e)
- {
- static const map<Enum, string> shit = {
- {A, "A"s},
- {B, "B"s},
- {C, "C"s},
- {D, "D"s},
- {E, "E"s},
- };
- return shit.at(e);
- }
- string enumToString2(Enum e)
- {
- switch (e) {
- case A: return "A"s;
- case B: return "B"s;
- case C: return "C"s;
- case D: return "D"s;
- case E: return "E"s;
- default: return "fuck you";
- }
- }
- string enumToString3(Enum e)
- {
- string ret;
- switch (e) {
- case A: ret = "A"s; break;
- case B: ret = "B"s; break;
- case C: ret = "C"s; break;
- case D: ret = "D"s; break;
- case E: ret = "E"s; break;
- default: ret = "fuck you"; break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement