Quote:
Originally Posted by Leonardo
I'll fix it if you tell me how to get size of an enum~
|
Quoting asherkin from another thread:
Quote:
Originally Posted by asherkin
An enum = a list of named values, i.e.
Code:
enum AnEnum
{
AnEnum_FirstValue,
AnEnum_SecondValue,
AnEnum_ThirdValue,
AnEnum_FourthValue,
AnEnum_FifthValue,
};
Now, if you print the values of each, you get:
AnEnum_FirstValue = 0
AnEnum_SecondValue = 1
AnEnum_ThirdValue = 2
AnEnum_FourthValue = 3
AnEnum_FifthValue = 4
This works with arrays because the name of the enum evaluates to the next number that would be assigned to an entry in it (AnEnum = 5),
so if you do
Code:
new AnArray[AnEnum];
you get an array with 5 members
|
In fact, this should work regardless because even sparse enums (with skipped values) will have a large enough array to store all values if you use the enum name. I actually just learned this today...
__________________