www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23231] New: splitWhen from std.algorithm is not CTFEable

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 puremagic.com
          Reporter: contact 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.

--
Jul 06 2022