Boost logo

Boost :

Subject: Re: [boost] [gsoc] Pointer Plus Bits Behavior and Interface
From: Stefan Strasser (strasser_at_[hidden])
Date: 2010-07-15 11:19:39

Zitat von Joaquin M Lopez Munoz <joaquin_at_[hidden]>:
>> 1) Should the pointer_plus_bits have a pre and post increment and decrement
>> ( what about supporting other arithmetic operations such as add, minus, add
>> assign etc...) ?
> I'd say this is gratuituous complication: just design a lean
> interface providing get_pointer, set_pointer, get_bit, set_bit
> (or similar names) so that you don't have to replicate pointer
> semantics.

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 has ptr-semantics, can be used as an iterator, etc.

to access the "bits" part:
integral_view<...> i(a);

bitset_view<...> bitset(a);

I'm also wondering why this has to be limited to pointer plus bits?
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.

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