Boost logo

Boost Users :

From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2008-05-29 14:37:03


On Thu, May 29, 2008 at 2:19 PM, Graham Reitz <graham.cpp_at_[hidden]> wrote:
>
> ...would like to convert to this in a C++'ish style using a boost
> facility if it exists: (or consider directing me somewhere else if it
> doesn't)
>

There isn't at the moment.

However, Beman Dawes has recently updated his proposed Boost.Endian
library (http://tinyurl.com/4bswsh), and there is a discussion about
it over on the dev list
(http://lists.boost.org/Archives/boost/2008/05/137820.php and
followups).

It would allow you to say (something like)

struct // or class
{
   boost::endian::uint_t<16, boost::endian::big_endian> first;
   boost::endian::uint_t<32, boost::endian::big_endian> second;
} data;

Which you could then std::copy your data into (through char*s), and
use the implicit conversions to get native integral types out.

HTH,
~ Scott


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net