This is as close as it gets, without using an intermediate compilation step:
1 2 3 4 5 6 7 8 9 10 11 12
enum Fruit{
Apple = 0,
Banana,
Orange,
Grape,
Mango,
COUNT,
};
//...
for (int i = Apple; i < COUNT; i++)
std::cout << (Fruit)i << std::endl;
The output will not be "Apple", "Banana", etc. Actually, at the moment I can't remember if operator<<()ing an enum value to std::cout compiles without user-defined overloads.