Move static asserts

So they trigger before they create a compile error
This commit is contained in:
monarch dodra 2014-01-22 14:56:12 +01:00
parent f680ea030f
commit cba9da3835

View file

@ -526,6 +526,11 @@ struct MersenneTwisterEngine(UIntType, size_t w, size_t n, size_t m, size_t r,
UIntType c, size_t l)
if(isUnsigned!UIntType)
{
static assert(1 <= m && m <= n);
static assert(0 <= r && 0 <= u && 0 <= s && 0 <= t && 0 <= l);
static assert(r <= w && u <= w && s <= w && t <= w && l <= w);
static assert(0 <= a && 0 <= b && 0 <= c);
///Mark this as a Rng
enum bool isUniformRandom = true;
@ -549,15 +554,10 @@ Parameter for the generator.
/// Largest generated value.
enum UIntType max =
w == UIntType.sizeof * 8 ? UIntType.max : (1u << w) - 1;
static assert(a <= max && b <= max && c <= max);
/// The default seed value.
enum UIntType defaultSeed = 5489u;
static assert(1 <= m && m <= n);
static assert(0 <= r && 0 <= u && 0 <= s && 0 <= t && 0 <= l);
static assert(r <= w && u <= w && s <= w && t <= w && l <= w);
static assert(0 <= a && 0 <= b && 0 <= c);
static assert(a <= max && b <= max && c <= max);
/**
Constructs a MersenneTwisterEngine object.
*/