Re: [Alephmodular-devel] Enum versus class?
Status: Pre-Alpha
Brought to you by:
brefin
From: Br'fin <br...@ma...> - 2003-03-02 17:18:02
|
On Sunday, March 2, 2003, at 10:46 AM, Alexander Strange wrote: > > On Saturday, Mar 1, 2003, at 14:27 US/Eastern, Br'fin wrote: > >> As part of dealing with abstracting the display stuff I found myself >> wanting to back off a little and implement a BitDepth enum. Or >> similar. So I've been dabbling with it, and in wanting some class >> related foo I ended up developing the following: >> >> class BitDepth >> <snip> > > Eww. Why not: > typedef enum Depth {depth_8bit = 8, depth_16bit = 16, depth_32bit = > 32} Depth; > that code that was actually checked in actually had enum BitDepth { _8bit= 8, _16bit= 16, _32bit= 32 }; And a couple serialization operators>>/<< It was also pointed out that doing typdef enum {...} EnumName; could be cleaned up a bit as just enum EnumName {...}; Using the class for a period did prove useful during the time when I was making sure that the rest of the code was properly using the enum instead of the raw numbers. -Jeremy Parsons |