Boost logo

Boost :

Subject: Re: [boost] [endian] swap_in_place use case
From: Tomas Puverle (tomas.puverle_at_[hidden])
Date: 2010-06-04 14:08:01

> If you're only going to access each element of the file, then converting
> endian on access should be faster than swapping in place and then
> processing, without needing double the memory.
> Could you please give a specific example (preferably with code) that I could
> play with?


I was under the impression I already provided you with a use case in an earlier

Converting to endian on access certainly won't be faster than swap_in_place, as
you cannot have a "zero cost" version. Additionally, in our scenarios the data
gets accessed multiple times.

But just to re-iterate:
1) swap_in_place<>() can be zero cost in the case of no swapping, which cannot
be said for the copying approach. I.e. it has a much better best case behaviour
and the same cost for the worst case behaviour.
2) It is one of the safer ways of handling floating point numbers.


Boost list run by bdawes at, gregod at, cpdaniel at, john at