Manipulating alias sequences
Ben Ogles
benjaminogles at gmail.com
Mon Jul 15 14:21:57 UTC 2019
On Monday, 15 July 2019 at 14:15:41 UTC, Stefan Koch wrote:
> On Monday, 15 July 2019 at 13:40:29 UTC, Ben Ogles wrote:
>> I have written a simple function that can call another
>> function over integral types with random arguments:
>>
>> [...]
>
> You cannot. meta-programming and compile-time evaluation are
> supposed to be deterministic,
> and hence cannot take random values.
Sorry, I wasn't clear. The code I wrote does not actually
_produce_ the random values at compile time. It is just a
template that evaluates to a function call where each argument is
given as `gen_rand_integral()`. So if I call
call_with_rand!(add)();
It will expand to
add(gen_rand_integral!(int)(), gen_rand_integral!(int)());
But I want a way to expand this to
add(gen_rand_integral!(int)(), user_defined_generator!(int)());
More information about the Digitalmars-d-learn
mailing list