Boost logo

Boost :

From: Martin (adrianm_at_[hidden])
Date: 2005-12-21 18:11:07


Some more suggestions:

- a bitfield member returning number of bits set (count() ?) could be useful.
- Move io to a separate header so iostream isn't necessary just to use
BOOST_ENUM.
- Bitfield io should'n force hex, 0-filled output for missing values. Let the
caller decide (or at least restore the stream format flags after).
- Maybe the io could use the boolalpha flag to decide if a numeric value or
text should be used for output.
- The normal separator in a stream is characters where isspace returns true,
not "|".
- I don't think it is necessary for bitfield operator>> to handle multiple
entries. It can be added on top by the caller if necessary. It should allow
numeric input though.
- Bitfield io should also handle format flags like width, right etc. My
suggestion is to let the width apply to each item and not to the entire value
(entire output can be handled by using a temporary buffer but not the other
way around).
Code change is trivial. Just save width on entry and apply it before streaming
each value when width>0.

e.g.
  cout << boolalpha << setw(10) << setfill('-') << right << mousekey;
outputs:
-----Shift ---Control

  cout << noboolalpha << dec << mousekey;
outputs:
12


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