I would like to create a composite type out of two enum classes.
enum classes
enum class Color {RED, GREEN, BLUE}; enum class Shape {SQUARE, CIRCLE, TRIANGLE};
That's a good question, but you don't actually need the number of Color to compare them :
Color
friend bool operator< (const Object &lhs, const Object &rhs) { if(lhs.color > rhs.color) { return false; } if(lhs.color < rhs.color) { return true; } return lhs.shape < rhs.shape; }