[Issue 19837] New: std.random.isUniformRNG(Rng, ElementType) should not require Rng.front to be annotated `@property`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 29 13:01:30 UTC 2019
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: nobody at puremagic.com
Reporter: n8sh.secondary at hotmail.com
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`.
}
---
--
More information about the Digitalmars-d-bugs
mailing list