[Issue 24048] New: Can't sort after filter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 18 15:16:42 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=24048

          Issue ID: 24048
           Summary: Can't sort after filter
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: grimmaple95 at gmail.com

This code fails to compile

```
auto a = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5];
a.filter!(x => x > 2).sort!((x, y) => x > y).writeln;
```

because you can't sort over filter result. Adding `.array` before `.sort`
"fixes" the problem. Probably, it should work without the `array` inbetween

--


More information about the Digitalmars-d-bugs mailing list