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
{
   public:
      typedef unsigned char type;
   public:
      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.

Regards,
Reece

_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger
http://www.msn.co.uk/messenger


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk