Following the C++ enum pattern I already described here, I was trying to do a similar thing but this time the sequence of values I want to use is not comprehended of continuous integer numbers.
The code is obviously wrong:
class Rotations
{
enum PossibleIndexes
{
ZERO,
PLUS180,
PLUS90,
MINUS90
};
enum PossibleValues
{
ZERO= 0,
PLUS180= 180,
PLUS90= 90,
MINUS90= -90
};
static int Count() { return MINUS90 + 1; }
static PossibleValues Default(){ return ZERO; }
};
as there will be conflicts between elements inherent of the two enums.
So my question is: What is the best approach to implement a fixed number of hardcoded Rotations{0, 180, 90, -90} which has also a Default and a Count functionality?