On Jul 20, 2006, at 10:34 AM, me22 wrote:
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.
One more area where they can't act like int's is in variable length
arguments. Even using my init() method, the following code won't
compile on the printf:
big4_t x = big4_t::init(42);
std::cout << x << "\n";
printf("%d\n", x);
warning: cannot pass objects of non-POD type 'struct
boost::integer::big4_t' through '...'; call will abort at runtime
One way around this is to add a get() method, so you can use:
printf("%d\n", x.get());
Or, as I prefer, use operator():
printf("%d\n", x());
Implemented as follows:
T operator()() const
{ return detail::load_big_endian