
me22 wrote:
I've been working on Yuval's suggestion of (little|big|native)_endian wrappers, but ran into a problem. On fundamental types, the wrapper works fine, and Beman's integer_cover_operators made it easy to add support for integer operations. ( However, why does integer_cover_operators use operators<T> and not operators2<T,IntegerType> ? I needed to change that to solve an ambiguity error. )
The problem comes when wrapping my (newly reimplemented) exact type. In that case, deriving the wrapper from integer_cover_operators adds 1 byte : sizeof( long ) = 0x4 sizeof( boost::big_endian< long > ) = 0x4 sizeof( boost::exact<24> ) = 0x3 sizeof( boost::big_endian< boost::exact<24> > ) = 0x4
I could just have a get member function in the wrappers, but that loses much of the elegance. Any suggestions for solving this?
Are you implementing the big_endian<T> class as holding a member of type T? If you do (that's the most logical way, I think), then it sounds most strange to me. Is it just one compiler that's causing problems? Have you tried on more than one compiler?