How to enum an enum?
From: Ernst Murnleitner (mur-spam_at_awite.de)
Date: 11/13/03
- Next message: lilburne: "Re: Global Variables"
- Previous message: Gianni Mariani: "Re: Is it ok to inherit from vector?"
- Next in thread: Rolf Magnus: "Re: How to enum an enum?"
- Reply: Rolf Magnus: "Re: How to enum an enum?"
- Reply: Victor Bazarov: "Re: How to enum an enum?"
- Reply: Shane Beasley: "Re: How to enum an enum?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 13 Nov 2003 00:42:37 +0100
Hello readers,
I want to enumerate all values in an enum, e.g.:
{
enum Family{A=0, B,C, D = 100, E};
BaseItem * p = Factory::Get...// BaseItem is the basis of many other items
// BaseItem has a virtual Function IsA(f) which tests if the item is member
of Family f.
int iNum = 0;
for(Family e = A; e <= E, e++) // but this does not work, of course
if(p->IsA(e))
iNum ++;
cout << "Item is Member of " << iNum << " families" << endl;
}
It seems not to be possible? Is there another elegant solution
Greetings
Ernst
- Next message: lilburne: "Re: Global Variables"
- Previous message: Gianni Mariani: "Re: Is it ok to inherit from vector?"
- Next in thread: Rolf Magnus: "Re: How to enum an enum?"
- Reply: Rolf Magnus: "Re: How to enum an enum?"
- Reply: Victor Bazarov: "Re: How to enum an enum?"
- Reply: Shane Beasley: "Re: How to enum an enum?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|