Boost logo

Boost :

From: me22 (me22.ca_at_[hidden])
Date: 2005-12-17 13:18:57

On 13/12/05, Frank Laub <frank.laub_at_[hidden]> wrote:
> Implementation notes:
> Instead of needing an 'Invalid' element, I just use Boost.Optional now.
> Thanks a ton for that suggestion Yuval!

Is the case of BOOST_BITFIELD, could you not simply use 0 as the
"nothing" value, instead of optional?

Also, is there that much of a use for being able to set the values for
BITFIELD? I think a simple version would be enough in most cases...

   (LeftButton) // would get the value 1<<0
   (RightButton) // would get the value 1<<1
   (Shift) // would get the value 1<<2
   (Control) // would get the value 1<<3
   (MiddleButton) // would get the value 1<<n

and then you could have none ( with value 0 ) and all ( with value ~0,
or (1<<n+1)-1 )

- Scott McMurray

P.S. As for that bitfield_iterator, it would have value_type bool and
act like an random-access iterator over the bits of the enum :P

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