Comment #0 by joseph.wakeling — 2015-07-26T11:43:51Z
Observed when trying to create a ref-counted random number generator:
import std.random, std.typecons;
static assert(isUniformRNG!Random);
static assert(isUniformRNG!(RefCounted!Random)); // FAILS
So far as I can tell, the problem is the check for the existence of the isUniformRandom boolean enum in the isUniformRNG template check:
https://github.com/D-Programming-Language/phobos/blob/master/std/random.d#L137-L140
i.e. while this check passes:
static assert(is(typeof(Random.isUniformRandom)));
this corresponding one fails:
static assert(is(typeof((RefCounted!Random).isUniformRandom)));
Clearly one could put the blame on the isUniformRNG template check here, but my feeling is that RefCounted should be able to forward _all_ properties and fields of the underlying type, including compile-time enum flags like isUniformRandom.
Comment #1 by joseph.wakeling — 2015-07-26T11:45:13Z
See also Issue #10888. Both these issues have nasty consequences for working with std.random functionality.
Comment #2 by joseph.wakeling — 2015-07-26T12:20:22Z
Same happens with Unique!Random:
static assert(isUniformRNG!(Unique!Random)); // FAILS
Comment #3 by robert.schadek — 2024-12-01T16:24:53Z