
On 7/20/06, Dave Dribin <dave-ml@dribin.org> wrote:
Hmmm... I'm not sure that would help in my case. The endianness need not be different for unions to be useful.
I was just guessing. Now that you've described your case, I see what your reason is. I'm not a fan of that macro hackery, however...
Sure, I'll go over the details in a second. But what's the use case/ rationale for *not* wanting to support unions?
The problem is that the classes can't properly act "like ints". The way they are now they can't be used in a union, as you've mentions. But take out the constructors and then the following rather logical program doesn't work any more: #include <boost/integer/endian.hpp> #include <iostream> int main() { boost::integer::big4_t x = 42; std::cout << x << "\n"; } And it can no longer be initialised in member initializer lists. I don't know whether this or unions is a more pressing concern, however. Do SFINAE-awayed constructors prevent a class from being used in unions? That might be a way to allow both if an eventual review can't come to a conclusion. ~ Scott McMurray