Struct that destroys its original handle on copy-by-value

Kagamin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 31 04:40:10 PDT 2015


On Sunday, 26 July 2015 at 12:16:30 UTC, Joseph Rushton Wakeling 
wrote:
> Example:
>
>     Unique!Random rng = new Random(unpredictableSeed);
>     rng.take(10).writeln;
> My aim by contrast is to _allow_ that kind of use, but render 
> the original handle empty when it's done.

`take` stores the range, you can try to use some sort of a weak 
reference.


More information about the Digitalmars-d-learn mailing list