So how exactly does one make a persistent range object?

Timon Gehr timon.gehr at gmx.ch
Mon Jun 6 04:00:31 PDT 2011


Andrej Mitrovic wrote:
>> On 6/6/11, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
>> So, anything you do on your own could be polymorphic, but as soon as you
>> get ranges from Phobos, you lose the polymorphism.
>
> Yeah, I've noticed that. I wouldn't want to loose the ability to call
> into std.algorithm/std.range or even Philippe's dranges library, which
> looks really neat. I guess I can use take() on a range and then
> array() to get the underlying type which I could easily pass to other
> functions. I'll see what I can come up with as I experiment with these
> features.

I don't get what the issue is. Static polymorphism can be turned into dynamic
polymorphism very easily. Just write a polymorphic wrapper template for ranges.
This will work with Phobos ranges just as well as with your own. ;)

Timon


More information about the Digitalmars-d-learn mailing list