Bug 19023 – findSplitBefore and findSplitAfter give wrong bool result
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-06-24T20:57:07Z
Last change time
2018-06-30T20:08:21Z
Keywords
pull
Assigned to
ag0aep6g
Creator
ag0aep6g
Comments
Comment #0 by ag0aep6g — 2018-06-24T20:57:07Z
Found while looking into issue 19020.
The results of findSplit, findSplitBefore, and findSplitAfter are all supposed to convert to "true when the separating needle was found" [1]. But only findSplit actually does. The other two misbehave:
----
import std.algorithm.searching: findSplitBefore, findSplitAfter;
void main()
{
assert(![1, 2, 3].findSplitBefore([4])); /* fails; should pass */
assert(![1, 2, 3].findSplitAfter([4])); /* fails; should pass */
}
----
[1] https://dlang.org/phobos/std_algorithm_searching.html#.findSplit