Boost logo

Boost :

Subject: Re: [boost] [gsoc] Pointer Plus Bits Behavior and Interface
From: David Abrahams (dave_at_[hidden])
Date: 2010-07-15 13:52:17


On Jul 15, 2010, at 1:43 PM, Joaquin M Lopez Munoz wrote:

>>
>> 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.

Joaquin's right, of course. This is a lot like compressed_pair and probably ought to follow that model. In fact, maybe this should just *be* another optimization of compressed_pair.

--
David Abrahams
BoostPro Computing
http://boostpro.com

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