Choice ranges?

Ali Çehreli acehreli at yahoo.com
Fri Mar 28 14:07:24 PDT 2014


On 03/28/2014 01:46 PM, bearophile wrote:
> H. S. Teoh:
>
>> So how would I implement something like this?
>
> One option is to wrap those ranges in classes. See std.range for the
> adapters. (I have not used them yet).

Link:

   http://dlang.org/phobos/std_range.html#.inputRangeObject

Short examples here as well under "Run-time polymorphism with 
inputRangeObject() and outputRangeObject()":

   http://ddili.org/ders/d.en/ranges_more.html

<quote>
inputRangeObject() is flexible enough to support all of the non-output 
ranges: InputRange, ForwardRange, BidirectionalRange, and 
RandomAccessRange. Because of that flexibility, the object that it 
returns cannot be defined by auto.
</quote>

Ali



More information about the Digitalmars-d-learn mailing list