digitalmars.D.bugs - [Issue 17634] New: variadic overload of
- via Digitalmars-d-bugs (21/22) Jul 11 2017 https://issues.dlang.org/show_bug.cgi?id=17634
https://issues.dlang.org/show_bug.cgi?id=17634 Issue ID: 17634 Summary: variadic overload of std.algorithm.searching.countUntil should return which needle was found Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: greensunny12 gmail.com Find does this already: https://dlang.org/phobos/std_algorithm_searching.html#.find.4A tuple containing haystack positioned to match one of the needles and also the 1-based index of the matching element in needles (0 if none of needles matched, 1 if needles[0] matched, 2 if needles[1] matched...). The first needle to be found will be the one that matches. If multiple needles are found at the same spot in the range, then the shortest one is the one which matches (if multiple needles of the same length are found at the same spot (e.g "a" and 'a'), then the left-most of them in the argument list matches).It would be convenient if countUntil would behave the same, but it's probably too late to change the return type, so the only way left is adding an optional `out` parameter. --
Jul 11 2017