[Issue 23231] New: splitWhen from std.algorithm is not CTFEable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 6 09:43:19 UTC 2022


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

          Issue ID: 23231
           Summary: splitWhen from std.algorithm is not CTFEable
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: contact at lsferreira.net

The following example should compile:

```
import std.algorithm.comparison : equal;
import std.range : dropExactly;
immutable source = [4, 3, 2, 11, 0, -3, -3, 5, 3, 0];

enum result1 = source.splitWhen!((a,b) => a <= b);
```

It doesn't because ChunkBy implementation is used for splitWhen and swapping
refcounter playloads are not supported due to a "fakePureCalloc" call.

--


More information about the Digitalmars-d-bugs mailing list