[Issue 9493] std.algorithm.canFind returns true for empty string in array of integers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 9 13:12:49 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=9493



--- Comment #5 from Peter Alexander <peter.alexander.au at gmail.com> 2014-02-09 13:12:47 PST ---
(In reply to comment #4)
> I'm not particularly satisfied with that, as I filed this as the result of a
> bug this behaviour caused, but I can't think of a good solution, either.
> Thoughts?

My thoughts:

1. We cannot change the fact that int is comparable with dchar. It would break
too much code.
2. We cannot change the fact that canFind works with two ranges of comparable
elements. It was part of the design, and would break too much code anyway.

I don't see any way around this.

I admit that at a first glance it doesn't look like it should compile, but it
does make sense once you consider what's happening.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list