Ranges with length that cannot be named

Andrei Alexandrescu SeeWebsiteForEmail at erdani.com
Wed Sep 25 18:09:28 UTC 2019


On 9/25/19 2:05 PM, berni wrote:
> On Wednesday, 25 September 2019 at 17:03:07 UTC, Andrei Alexandrescu wrote:
>> Also, there's a more productive view - instead of a classification of 
>> ranges, think of "length" as an optional attribute of a range.
> 
> On a more abstract level this is indeed a nice view. In case of iota 
> though, I'm lost a little bit with this, especially the version with "if 
> (isFloatingPoint!(CommonType!(B, E, S)))". Depending on B, E and S this 
> might have a calculatable length or not. Should we omit length here 
> altogether? If not, how to cope with the cases, where we cannot 
> calculate it?

Yes, certain iota instantiations should not define length. For such 
ranges, length is not expressible as a size_t, and that's okay. Just 
manipulate it as any range with no known length.



More information about the Digitalmars-d mailing list