Boost logo

Boost :

Subject: Re: [boost] [random] Use of make_unsigned/make_signed
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-03-14 14:46:23


On 03/14/2012 11:30 AM, John Maddock wrote:
> 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.

At the moment, the library assumes that all
IntType/UIntType parameters are built in
integral types. I think more changes than
just this would be required to allow UDT's.

> 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?

In Christ,
Steven Watanabe

Boost list run by bdawes at, gregod at, cpdaniel at, john at