How to sort 2D Slice along 0 axis in mir.ndslice ?

Pavel Shkadzko p.shkadzko at gmail.com
Wed Mar 11 10:25:34 UTC 2020


On Wednesday, 11 March 2020 at 06:12:55 UTC, 9il wrote:
> On Wednesday, 11 March 2020 at 00:24:13 UTC, jmh530 wrote:
>> [...]
>
> Almost the same, just fixed import for `each` and a bit polished
>
> /+dub.sdl:
> dependency "mir-algorithm" version="~>3.7.18"
> +/
> import mir.ndslice;
> import mir.ndslice.sorting;
> import mir.algorithm.iteration: each;
>
> void main() {
>     auto m = [[1, -1, 3, 2],
>               [0, -2, 3, 1]].fuse;
>     m.byDim!0.each!sort;
>
>     import std.stdio;
>     m.byDim!0.each!writeln;
> }

Great, thanks guys!


More information about the Digitalmars-d-learn mailing list