Automatic range creation for class or struct?

Peka via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 9 16:25:13 PST 2016


On Wednesday, 10 February 2016 at 00:22:46 UTC, cym13 wrote:
> On Wednesday, 10 February 2016 at 00:05:36 UTC, Peka wrote:
>> Hi!
>>
>> I have class (or struct) which realises .length() and 
>> .opIndex(size_t) methods.
>>
>> It is possible to create from this class some sort of range 
>> using template from std? (I mean that internal counter, 
>> .popFront(), .empty() etc methods should be added by template.)
>
> I don't think anything like that exists in phobos

I need definitive answer.

> but it's not hard to pull it out using mixin templates:

Sure! Thanks a lot, but I want to use std lib as much as possible


More information about the Digitalmars-d-learn mailing list