Forward ranges in Phobos v2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.com
Wed Nov 3 15:49:21 UTC 2021


On 2021-11-03 11:28, jmh530 wrote:
> On Wednesday, 3 November 2021 at 15:03:53 UTC, Andrei Alexandrescu wrote:
>> [snip]
>>
>> Good point. Maybe have all ranges define that enum with values true 
>> and false respectively?
> 
> Maybe I just haven't been following this discussion closely enough, but 
> I'm a little confused by this. We have `__traits(hasMember, T, 
> inputRangeTag)` after all. There should be default behavior when that 
> tag isn't there and more sophisticated behavior when it is (if it is 
> needed).

Yah that's what I had in mind - hasMember is actually easier. I think 
the problem is that code that forgets to do the check may easily do the 
wrong thing.


More information about the Digitalmars-d mailing list