More range woes: std.array.save is invalid

monarch_dodra monarchdodra at gmail.com
Thu Dec 20 07:47:10 PST 2012


On Thursday, 20 December 2012 at 15:25:27 UTC, H. S. Teoh wrote:
> On Thu, Dec 20, 2012 at 12:08:24AM -0800, Jonathan M Davis 
> wrote:
>> On Wednesday, December 19, 2012 23:44:12 H. S. Teoh wrote:
>> > Yes, which means many current algorithms that take a range 
>> > of ranges
>> > and returns a wrapper range are wrong, because they assume 
>> > that the
>> > wrapper range can be a forward range when both the container 
>> > and the
>> > subranges are forward ranges, but this is not a sufficient 
>> > condition
>> > in the general case.
>> 
>> Then they have bugs in their implementation which need to be 
>> fixed.
>> There's nothing wrong with std.array.save. It's doing the 
>> right thing.
> [...]
>
> OK, so the subject line is misleading.
>
> But the bigger issue is that wrappers of forward ranges of 
> forward
> ranges can only be input ranges, in spite of the fact that, in 
> theory,
> you can save each component of the given range of ranges.
>
>
> T

Why is that?

If the wrapper is *designed* as being a RoR, then the "elements"
of the range are defined as being part of the iteration scheme.
Once you have defined it that way, you can have the wrapper save
the top Range, as well as each sub-range individually, and then
the wrapper is Forward... No?


More information about the Digitalmars-d mailing list