hap.random: a new random number library for D
Joseph Rushton Wakeling via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Sun Jul 13 09:01:10 PDT 2014
On Sunday, 13 July 2014 at 15:34:31 UTC, Dicebot wrote:
> std.typecons.scoped _should_ still work - I actually suggest
> adding unit tests for this as it is quite an important use case.
std.typecons.scoped works per se (I'm adding unittests as we
speak) but using my current dmd, this:
// confirm scoped allocation is @nogc
void scopedRNG(T)(T seed) @nogc
{
auto gen = scoped!UniformRNG(seed);
}
scopedRNG(unpredictableSeed);
... fails to compile with the error,
Error: @nogc function
'hap.random.generator.__unittestL91_27.scopedRNG!uint.scopedRNG'
cannot call non- at nogc function
'std.typecons.scoped!(LinearCongruentialEngine!(uint, 16807u, 0u,
2147483647u)).scoped!(uint).scoped'
... even if the constructor of the RNG in question is marked
@nogc together with all that it calls.
Is this possibly an issue with 'scoped'? Was it only quite
recently patched to support @nogc? I'll update my installed
compiler if so.
More information about the Digitalmars-d-announce
mailing list