
David Abrahams <dave <at> boostpro.com> writes:
On Jul 15, 2010, at 1:09 PM, Andrew Sutton wrote:
One could argue that the bits should be evaluated to produce the Boolean result as easily as evaluating the pointer. There are two aspects in pointer_plus_bits and they shouldn't be obscured or conflated.
I strongly disagree with using views in the design of this data structure. It's not such a complex concept that you would need to explicitly decouple its concerns via views. You end up designing a pointer+bits that can't be used natively as a pointer or bits.
I agree with Andrew.
I disagree with Dave and Andrew. There is no natural concept around "a pointer plus some bits". These are packed together to save space, which is an aspect completely orthogonal to whatever purspose the pointer and the bits serve (separately). To me, pointer_plus_bits should be as similar as possible to having two members, one a pointer the other the bits, so that for instance the following class X { ... pointer ptr; bool b; }; can be rewritten as class X { ... pointer_plus_bits<...> pb; }; so as to save memory, with as little change from the original situation as possible (for instance, instead of x.ptr one would say x.pb.ptr() and so forth). Overelaborating on an concept+bits concept seems to me to be missing the point. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo