Enum classes are now preferred over regular enums
How can I iterate using a for loop? I'm not using the entire set only a sub set within the set.
They are integers and my work around is this
There are ways to do that -> https://riptutorial.com/cplusplus/example/13085/iteration-over-an-enum
However, since I need to map enums to strings, I simply iterate an unordered_map, like this:
Then I simply iterate the map. It works great
If you don't care about the key, just make it an int, or even an unsigned char.
std::unordered_map is quite fast.
Edit:
I recommend this if you ever needed to switch using std::string ->
But I digress
Are you sure you are not turning this on its head, shouldn't the resource objects have a property containing their type? Or maybe even be of different classes?
What I do, in my overengineered project, is this ->
I am not sure if it's the right thing to do, but it works.
Could perhaps be adapted, or serve as a warning?