Subject: Re: [boost] [boost::endian] Request for comments/interest
From: Dave Handley (Dave.Handley_at_[hidden])
Date: 2010-05-28 15:29:38
"Cliff Green" wrote:
> In most general marshalling / serialization designs where portable binary
> values are required, the transform step (from "wire" to "object / memory"
> model) requires a copy anyway. The low-level endian facilities should not
> require an extra copy, but trying to minimize all copying and constraining
> the endian library design might be misguided.
In the sort of code I write, an endian swapper that had copies that weren't necessarily required, especially in the "do nothing" case where network and machine have the same endianness would not be fit for purpose.
" " wrote:
> This is not completly true, as your implementation will at least visit the instance.
I disagree. If you look in more detail at the code that Tom has submitted, the "do nothing" case does exactly that - nothing. Specifically line 147-154 has the template specialisations that get invoked when a no-op is required, and they have no code in them. Only in the case where an endian swap is required does the implementation walk through the whole data structure.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk