fold on empty range
Rumbu
rumbu at rumbu.ro
Wed Feb 17 14:52:54 UTC 2021
On Wednesday, 17 February 2021 at 12:58:29 UTC, Mitacha wrote:
> On Wednesday, 17 February 2021 at 11:38:45 UTC, Rumbu wrote:
>> [...]
>
> If you replace `fold` and `splitter` with this, then it doesn't
> allocate:
> ```
> auto fn() @nogc {
> return only("k1,k2", "k3,k4")
> .map!(x => x.splitter(","))
> .joiner;
> }
>
> void main() {
> auto range = fn();
> range.writeln;
> }
> ```
Wow, thanks a lot.
More information about the Digitalmars-d-learn
mailing list