On 26/07/15 13:45, Martijn Pot via Digitalmars-d-learn wrote:
Sounds like unique_ptr (so UniqueRange might be a nice name). Maybe you can get
some ideas from that.

There is already a Unique in std.typecons. However, I'm not sure that it's doing what I require.

Example:

    Unique!Random rng = new Random(unpredictableSeed);
    rng.take(10).writeln;

... will fail with an error:

Error: struct std.typecons.Unique!(MersenneTwisterEngine!(uint, 32LU, 624LU, 397LU, 31LU, 2567483615u, 11LU, 7LU, 2636928640u, 15LU, 4022730752u, 18LU)).Unique is not copyable because it is annotated with @disable

My aim by contrast is to _allow_ that kind of use, but render the original handle empty when it's done.

Reply via email to