Ranges and random numbers -- again

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Tue Jun 18 03:54:33 PDT 2013


On 06/18/2013 11:31 AM, monarch_dodra wrote:
> On Tuesday, 18 June 2013 at 10:16:02 UTC, Joseph Rushton Wakeling wrote:
>> std.range.Take uses this constructor:
>>
>>     this(R input) { _original = input; _current = input.save; }
> 
> It shouldn't. It is the caller who should chose to (or not to) save.

Ack, you're quite right.  Take doesn't even have a constructor -- that's a
constructor for Cycle.

I agree with your principle about it being the caller's decision whether or not
to .save, but can that be assumed in general?  I thought there were Phobos
algorithms or ranges that deliberately took saved copies for internal use.


More information about the Digitalmars-d mailing list