How to get the number of elements of an enum type without declaring an instance?

Below is an example.


typedef enum { red, green, blue, yellow, white, black } Colors;

// Can I do something like this?
int num_of_Colors = Colors.num ();

// Or this?
int num_of_Colors = Colors :: num ();

In reply to rzhang313:

Unfortunately you can’t call a method on a type. If you know the last label is black, then black+1 is the number of elements.