From: David Abrahams (dave_at_[hidden])
Date: 2002-11-14 19:35:04
"Kevin S. Van Horn" <Kevin.VanHorn_at_[hidden]> writes:
> David Abrahams writes:
>> Looks cool. I don't usually need such a thing, though. Could you give
>> some examples of likely use cases?
> The impetus for bit_struct was a discussion with a local business on possible
> student library projects that would benefit the business. This company writes
> a lot of embedded software. They are dealing with a network protocol that
> allows them to pack any number of parameters into a message of exactly eight
> bytes. Note that byte order within multibyte integers is an issue I
> have not addressed with bitstruct; if one wishes to send a bitstruct
> over the network, then either the sender and receiver must have the
> same integer sizes and byte orders, or you need an additional
> facility to put bytes into a standard order (like the Unix htonl,
> htons, ntohl, and ntohs functions, but templatized.)
> This kind of thing might also be useful in writing memory
> allocators, where you want to tightly pack information into a small
> header for a block of memory. It might also be useful in
> implementing tagged data for dynamically-typed languages.
Thanks for the explanation.
-- David Abrahams dave_at_[hidden] * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk