[Issue 23755] New: array.until!pred should return an array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 2 09:53:52 UTC 2023


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

          Issue ID: 23755
           Summary: array.until!pred should return an array
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: default_357-line at yahoo.de

Consider this testfile:

```
import std;
void main()
{
    auto arr = "Hello World";
    auto result = arr.until(" ");
    // This doesn't work, why?
    assert(result == "Hello");
    assert(result.array == "Hello");
}
```

When `until` notices that its parameter is an array, it should really just
return a slice. This makes it easier to use and reduces the need for further
allocations.

--


More information about the Digitalmars-d-bugs mailing list