Hello,
This may be more appropriate for the devel list, but someone just
pointed out on this list that an endian library has been submitted
for approval. I've *just* needed classes like this (actually I wrote
my own similar classes), and decided to see how the Boost library
stacked up. It looks quite nice, and I'd be excited to see this
included. One suggestion I would make is that the endian classes
should not have constructors. As of version 0.5, trying to put them
into a union causes a compiler error. Take the struct from the
example, and add a union:
struct header
{
big4_t file_code;
big4_t file_length;
little4_t version;
little4_t shape_type;
union
{
big4_t foo;
little4_t bar;
} baz;
};
I get the following errors:
endian_example.cpp:37: error: member 'boost::integer::big4_t
<unnamed>::header::<anonymous union>::foo' with constructor not
allowed in union
endian_example.cpp:38: error: member 'boost::integer::little4_t
<unnamed>::header::<anonymous union>::bar' with constructor not
allowed in union
By removing all constructors, the errors go away. I cam across this
very issue when developing my classes, and found the answer in this
comp.lang.c++.moderated post:
<http://groups.google.com/group/comp.lang.c++.moderated/msg/
103835a7b493723e?hl=en&>
As an experiment, I modified boost/integer/endian.hpp to remove the
constructors, and add an operator=() to see if this worked, and it did:
template