March 02, 2023 [Issue 23755] New: array.until!pred should return an array | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: default_357-line@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. -- |
Copyright © 1999-2021 by the D Language Foundation