Boost logo

Boost :

From: Scott McMurray ([hidden])
Date: 2008-05-24 11:23:11

On Sat, May 24, 2008 at 7:45 AM, Beman Dawes <bdawes_at_[hidden]> wrote:
> Neil Mayhew wrote:
>> The areas that I am interested in seeing more work done on are (1)
>> making constructors "conditional" and (2) adding a bit-range access method.
> Do you have a proposed design for bit-range access?
> What is the use case or motivation for bit-range access?

Perhaps something based off of erlang's Bit Syntax?

Armstrong's Erlang book gives MPEG headers as an example of bit range
access, among other things.

So something like

typedef bit_sequence<
> MPEG_header;

Or if you're writing a linker to generate EXEs for windows (another
example from Armstrong's book),

typedef bit_sequence<
    little_endian< uint_t<32> >, // Characteristics
    little_endian< uint_t<32> >, // TimeDateStamp
    little_endian< uint_t<16> >, // MajorVersion
    little_endian< uint_t<16> >, // MinorVersion
    little_endian< uint_t<16> >, // NumberOfNamedEntries
    little_endian< uint_t<16> > // NumberOfIdEntries
> image_resource_directory;

Be fun to be able to get everything as a tuple, too, to be able to
assign to a tie, pattern-matching style

That interface works better for the bit ranges, though, I suppose,
since little_endian< uint_t<32> > as a boost.endian type on its own
would be far more convenient name-wise than having to get it through a
tuple-style interface.

Just thinking out loud,
~ Scott

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