std.v2020.algorithm etc[ WAS: Is run.d going to be expand for runtime and the phobos library?]

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Jun 21 00:02:54 UTC 2020


On 6/20/20 3:23 PM, Jon Degenhardt wrote:
> On Saturday, 20 June 2020 at 18:26:43 UTC, Steven Schveighoffer wrote:
>> But the larger point is that true input-only ranges are rare. The only 
>> problem is for classes, since you cannot invoke a copy constructor on 
>> those.
> 
> Interesting discussion. Could you expand on this comment? Several people 
> have mentioned this.
> 
> I write my own input ranges somewhat regularly. I've never had the need 
> to make them forward ranges. However, the typical reason for creating a 
> range is because I have application specific data that I want to iterate 
> over (and usually construct) lazily. Input ranges are very convenient 
> way to do this. I do end up making many of them reference ranges though.
> 
> So, I'm wondering if its really that input-only ranges are rare, or if 
> it's that the number of algorithms that can be used on input-only ranges 
> is small. Or perhaps I'm not quite grokking the distinction between a 
> "true" input-only range and one that satisfies isInputRange, but none of 
> the other range primitive tests.

Numbers are kinda in your favor. Without getting anywhere near 
scientific about it:

git grep isInputRange | wc -l
      601
git grep isForwardRange | wc -l
      369
git grep isBidirectionalRange | wc -l
      167
git grep isRandomAccessRange | wc -l
      285


More information about the Digitalmars-d mailing list