|
Boost : |
Subject: [boost] [boost::endian] Request for comments/interest
From: Tomas Puverle (tomas.puverle_at_[hidden])
Date: 2010-05-26 12:37:06
I wrote an endian library on the flight back from boostcon but it has taken a
little time to clear the submission with the firm.
I realize that Beman's endian swapper library is already in the review queue but
I hope my approach is different and interesting enough to warrant consideration.
It's located here in the vault (Utilities/endian-puverle.zip):
The highlights of the library are the following:
- Very simple interface: swap<machine_to_little/big>(),
swap_in_place<machine_to_little/big>()
- Support for built-in and user-defined data types and ranges thereof. E.g. you
can swap ranges of structs containing/deriving from other structs
- endian::iterator, which will iterate across a range swapping values as
necessary. It works with any swappable type.
The library is described/documented/tested in the file main.cpp at the root of
the zip archive.
Unfinished items:
- Right now, the library only includes the "vanilla" swapper, meaning it
doesn't take advantage of special instructions on architectures which natively
support endian conversion. I didn't include this in order to prevent cluttering
the code with #ifdefs. This functionality would, however, be part of the final
library.
- Ideally, the metafunction is_mutable_range<> should be moved out of
endian::detail and become part of Boost.Range of Boost.TypeTraits.
I have donned by bulletproof vest and I'm ready for any feedback you may have. :)
Tom
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk