I'm trying to use a C-style array as a map through enums but I can't initialize arrays by parts... I'll explain myself better through code:
I have something like:
enum Objects{CAR = 0, PLANE, BOY};
I have:
static const char* texturePaths[] = {"..\\car.png", "..\\plane.png", "..\\boy.png"};
and that actually works the way I want, i.e.
initTexture(texturePaths[CAR]);
but in this way I must to make sure that I'm declaring in the same order both enum and array. I'd like to do something like this:
enum Objects{CAR = 0, PLANE, BOY, size};
const char* texturePaths[Objects::size];
texturePaths[BOY] = "..\\boy.png";
texturePAths[CAR] = "..\\car.png";
...
I know that could work, but I need to do it inside a function and call it, so run time. I want to do it at compile time because there are constant values that will never change and it's a waste to do it at run time.
I also know that constexpr could do it through lambda functions, but I don't know how to do it
CAR = 0by default