https://issues.dlang.org/show_bug.cgi?id=19837
Issue ID: 19837
Summary: std.random.isUniformRNG(Rng, ElementType) should not
require Rng.front to be annotated `@property`
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: [email protected]
Reporter: [email protected]
Example:
---
void main()
{
import std.random : isUniformRNG;
static struct RND1
{
ulong state;
@property uint front() const { return cast(uint) (state >> 32); }
void popFront() { state = state * 6364136223846793005 +
1442695040888963407; }
enum empty = false;
enum isUniformRandom = true;
}
static struct RND2 // Same but `front` is not @property
{
ulong state;
uint front() const { return cast(uint) (state >> 32); }
void popFront() { state = state * 6364136223846793005 +
1442695040888963407; }
enum empty = false;
enum isUniformRandom = true;
}
static assert(isUniformRNG!RND1);
static assert(isUniformRNG!(RND1, uint));
static assert(isUniformRNG!RND2);
static assert(isUniformRNG!(RND2, uint)); // Fails because RND2.front is
not `@property`.
}
---
--