On Jul 14, 2009, at 9:16 PM, David Hagood wrote:
I'd take it one step further, and make the byteswapped objects their own types:
I agree, this is a good idea. However I think my co-worker would argue against the additional overhead and in favor of the ease of use of a simple function template. It seems we both feel that his idea isn't safe though ;)
Have you looked at Beman Dawes's preposed Boost.Endian library? It seems like it might be quite useful in writing a "swapped" type.
The other alternative is to simply return a byte-array (or vector or deque or whatever), but that's less featureful than a swapped type could be.
-- Andrew Troschinetz (512) 835-3410 Applied Research Laboratories