On 2015-08-14 09:28, Gary Willoughby wrote:

I was confused a lot about ranges until I realised that a range is only
a `view` onto the data. A range is not *the* data.

For example, consuming a range does not consume the underlying data or
modify it in any way. A forward range's save method is for creating a
copy of the view, not a copy of the underlying data. This is to allow
two ranges to be consumed independently without affecting the data.

Usually, these ranges are returned in the form of a Result struct as
shown here:
https://github.com/D-Programming-Language/phobos/blob/master/std/uni.d#L6517

Until you work with arrays, which is both data and a range at the same time.

--
/Jacob Carlborg

Reply via email to