I really do not see any way to really get to the number of values in an enumeration in C++. Any of the before mention solution work as long as you do not define the value of your enumerations if you define you value that you might run into situations where you either create arrays too big or too small
enum example{ test1 = -2, test2 = -1, test3 = 0, test4 = 1, test5 = 2 }
in this about examples the result would create a array of 3 items when you need an array of 5 items
enum example2{ test1 , test2 , test3 , test4 , test5 = 301 }
in this about examples the result would create a array of 301 items when you need an array of 5 items
The best way to solve this problem in the general case would be to iterate through your enumerations but that is not in the standard yet as far as I know