Creating a Sub-view of a non - RA (hasSlicing) range.

Dmitry Olshansky dmitry.olsh at gmail.com
Sat Jun 30 06:15:39 PDT 2012


On 30-Jun-12 15:35, Tobias Pankrath wrote:
>> Say I have a forward range (for example, an SList[]). I would like to
>> create a new range containing only the first 5 elements of that old
>> range. How can I do that?
>>
>
> std.algorithm.take.
>
> But I would generally avoid SList.

Indeed. I'd be hard pressed to devise realistic use case where it 
performs better.

That makes me think that a proper type people should be using is the 
unrolled list, that is a list of fixed-sized array chunks.

Or even chunked array like bearophile suggests.
-- 
Dmitry Olshansky




More information about the Digitalmars-d mailing list