I have 4 separate integers that need to be mapped to an arbitrary, constant value.
For example, 4,2,1,1 will map to the number 42
And the number 4,2,1,2 will map to the number 86.
Is there anyway I can achieve this by using #define’s or some sort of std::map. The concept seems very simple but for some reason I can’t think of a good, efficient method of doing it. The methods I have tried are not working so I’m looking for some guidence on implementation of this.
Will a simple function suffice?
Now that may look ugly, but you can easily create a macro to pretty it up. (Or a helper class or whatever… I’ll just show the macro as I think its easy.
If you really care you can probably craft a constexpr version of this too, which you’ll never be able to do with
std::mapbased solutions.