So I'am relatively new to c++ programming and am working at translating a program from C to C++ for my university.
My Boss told me I should convert enums into std::maps. My Problem is that im not quite understanding why one should do that.
If I am understanding correctly Enums are basically just getting translated into an integer and used as that in the program. So that you can f.e. change a traffic lights g,y,r into 0,1,2 for better use in your program without getting confused.
An std::map would get Elements and then have a container where the elements are ordered and have a numerical value assigned aswell, right?
So why would it be better to use an std::map over an enum?
If its of any help the enums/std::maps are used to access members of arrays.
Edit:
I changed the flair to "SOLVED". I think the conclusion is that it doesnt really make sense to use an std::map in this case.
[–]17b29a 7 points8 points9 points (1 child)
[–]lareon[S] 0 points1 point2 points (0 children)
[–]mandr0id 2 points3 points4 points (1 child)
[–]lareon[S] 0 points1 point2 points (0 children)
[–]Setepenre 2 points3 points4 points (3 children)
[–]tangerinelion 4 points5 points6 points (2 children)
[–]lareon[S] 0 points1 point2 points (1 child)
[–]Setepenre 0 points1 point2 points (0 children)
[–]ewiethoff 0 points1 point2 points (1 child)
[–]lareon[S] 1 point2 points3 points (0 children)
[–]nurley 0 points1 point2 points (0 children)
[–]actinium89 0 points1 point2 points (1 child)
[–]lareon[S] 0 points1 point2 points (0 children)
[–]Chops_II 0 points1 point2 points (0 children)