$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: [boost] [random] Use of make_unsigned/make_signed
From: John Maddock (boost.regex_at_[hidden])
Date: 2012-03-14 14:30:43
Several of the random number distributions use make_[un]signed internally.
However, this trait is not intended as a customization point for UDT's -
it's only supposed to be instantiated for integer or enum types - and yes
that's a deliberate decision that's now enshrined in the standard ;-)
Unfortunately this means that these distributions can't be instantiated on
UDT's - big number types for example.
Since it seems that these traits are only used to obtain a type that is
large enough to store a difference between the endpoints of a range, would
it be possible for these to change to use something like:
namespace boost{ namespace random{
template <class T>
struct range_type : public make_signed<T>
{
};
}}
Then range_type could be [partially-] specialized for UDT's. Note that for
some types, there might simply not be a corresponding unsigned type at all,
but I'm assuming that doesn't foul up the logic, as long as the type is wide
enough?
Comments?
Thanks, John.