
On Tue, Jun 8, 2010 at 12:46 PM, Gottlob Frege <gottlobfrege@gmail.com> wrote:
On Tue, Jun 8, 2010 at 11:52 AM, Stewart, Robert <Robert.Stewart@sig.com> wrote:
Technically, the output endianness would take the place of the int. But then you'd need a secondary cast, I suppose. ie
big j = endian_cast<big, little>(k); int i = reinterpret_cast<int>(endian_cast<big, little>(k));
which could maybe be somehow shortened? But that is what is actually being done. If I understand the use case correctly.
int i = endian_cast<big, little>(k).raw(); Not saying it's perfect or anything. In particular, I still cringe at any code of the form "functionA().functionB()" (Well, functionA()->functionB() more so). But it keeps some consistency and makes the non-type-safe stuff more explicit. Tony