|
Boost : |
From: Emile Cormier (emilecormier_at_[hidden])
Date: 2006-03-06 18:40:30
You can download the code at the Boost vault:
http://boost-consulting.com/vault/index.php?&direction=0&order=&directory=bitfield
test.cpp contains a regression test that you can try on your compiler.
Please let me know if it works, as I've only tested this on MinGW GCC
3.4.
The bitfield mechanism relies on this assumption: Unions of
non-polymorphic, non-derived objects, having the exact same underlying
data member type, will have the same size as this underlying data member
type. I'm no language lawyer, so please let me know if this is a safe
and portable assumption.
Let me know if things aren't sufficiently self-explanatory, or if things
can be improved.
-- Emile Cormier emilecormier_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk