Range Redesign: Empty Ranges

Steven Schveighoffer schveiguy at gmail.com
Thu Mar 7 18:16:09 UTC 2024


On Wednesday, 6 March 2024 at 17:32:17 UTC, H. S. Teoh wrote:
> On Wed, Mar 06, 2024 at 04:47:02PM +0000, Steven Schveighoffer 
> via Digitalmars-d wrote: [...]
>> The only tricky aspect is ranges that are references 
>> (classes/pointers).  Neither of those to me should be 
>> supported IMO, you can always wrap such a thing in a range 
>> harness.
> [...]
>
> Every time this topic comes up, class-based ranges become the 
> whipping boy of range design woes.  Actually, they serve an 
> extremely important role: type erasure, which is critical when 
> you have code like this:

As Jonathan already responded, you can have a class range by 
wrapping it in a struct. Which is what I meant when I said:

"you can always wrap such a thing in a range harness"

-Steve


More information about the Digitalmars-d mailing list