dlang.org/Learn "hello_world".sort.chain ...

Sergey kornburn at yandex.ru
Tue Dec 26 14:10:01 UTC 2023


On Tuesday, 26 December 2023 at 13:58:54 UTC, tony wrote:
> On Tuesday, 26 December 2023 at 11:19:29 UTC, Sergey wrote:
>
>> Use typeid, instead of typeof
>
> Thanks!
>
> Got quite a type but I will worry about that later: 
> std.range.SortedRange!(Result, "a < b").SortedRange

Yes, because sort is returning special type, compatible with 
Ranges interface.
You can add 'sort(...).array' and the type will become 'int[]' 
(or which types arrays were before).

Ranges are specific things for D (one of the core feature of the 
lang and std), which can evaluated lazily. You can check some 
description how they are working in the documentation 
https://dlang.org/phobos/std_range.html


More information about the Digitalmars-d-learn mailing list