Boost logo

Boost :

From: jeetsukumaran_at_[hidden]
Date: 1999-11-08 04:26:23


Hi John:

Thanks for the suggestion. The reason that I did not use the enum
hack, i.e.

> template<typename Generator>
> class uniform_deviate{
> public:
> enum{
> rand_max = 0xffffffff,
> uint_div = rand_max,
> sint_div = rand_max/2
> };
> // etc....
> };

is for reasons of expandability. Like I mentioned, I was hoping that
these numbers would be allowed to vary considerably, in type as well as
size, with the particular Generator involved, being passed to the
template by a generator_traits type structure maintained/defined by the
Generator. SO I wanted to maintain a strict variable-based semantics
and syntax for these constructs, both in theory as well as in practice
(in practice, there would be no difference at all between using enums
or static consts, given the current representation).

>
> template<typename Generator>
> class uniform_deviate{
> public:
> static const randnum_t rand_max = 0xffffffff;
> static const uinteger_t uint_div = rand_max;
> static const uinteger_t sint_div = rand_max/2;
> // etc....
> };
>

Portability is the main killer here. Even though perfectly legal, MSVC
does not like the above definitions.

-- jeet


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk