Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2003-05-27 05:57:48

I have adopted a Java-style approach to enumerated-style values (don't know
if this is the best approach, just the way that I do it now). For example:

class WhatIsTheMatrix
      typedef unsigned char type;
      static const type TheWhat = 0;
      static const type Matrix = 1;
      static const type AniMatrix = 2;
      static const type MatrixReloaded = 3;
      static const type MatrixRevolutions = 4;

It could be possible to use the suggestions for enumerated type traits to
support this form and convert the class into its own data type, so you could
use it like:

WhatIsTheMatrix witm(); // initialized to WhatIsTheMatrix::TheWhat
WhatIsTheMatrix neo( WhatIsTheMatrix::MatrixReloaded );

if( witm == neo ) ...;
else ...;

-- just an idea.


Stay in touch with absent friends - get MSN Messenger

Boost list run by bdawes at, gregod at, cpdaniel at, john at