Boost logo

Boost :

Subject: Re: [boost] [gsoc] Pointer Plus Bits Behavior and Interface
From: Brian Bartman (bbartmanboost_at_[hidden])
Date: 2010-07-15 11:51:32

On Thu, Jul 15, 2010 at 11:19 AM, Stefan Strasser <strasser_at_[hidden]>wrote:

> I'd say an interface with pointer semantics is useful, but can be built
> upon the a interface like you're describing. for example:
> pointer_plus_bits<...> a;
> to access the pointer part:
> pointer_view<...> ptr(a);
> //++ptr;
> //ptr has ptr-semantics, can be used as an iterator, etc.
> to access the "bits" part:
> integral_view<...> i(a);
> i=3;
> bitset_view<...> bitset(a);
> bitset.set(2,true);
> I'm also wondering why this has to be limited to pointer plus bits?

Some of the other portions of my work may better address your concern.
Specifically, a bitfield_tuple allows you do to close to what you're
suggesting. However the genericness of the data structure still needs to be
expanded slightly to allow the data structure to handle custom setting and
retrieval of user specified fields (such as in the above case pointer).

> unused bits in a variable isn't something that is limited to pointers. an
> integer variable might always be even, or have a maximum value so that upper
> bits are always unused.

I completely agree.

Brian Bartman

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