http://d.puremagic.com/issues/show_bug.cgi?id=9493
monarchdo...@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |monarchdo...@gmail.com --- Comment #1 from monarchdo...@gmail.com 2013-02-10 03:34:19 PST --- (In reply to comment #0) > It seems that std.algorithm.canFind returns true when checking for the empty > string within an array of integers. This seems like unintended behaviour to > me, > so I'm reporting it as a bug. This bug is present on at least DMD 2.061. > > Example: > import std.algorithm; > > void main() > { > //This assertion should fail, but doesn't > assert(canFind([1, 2, 3, 4], "")); > } I think this is inteded behavior. You are basically looking for instances of *nothing*, which, by definition, can be found inside everything (*). I'd expect a true returned here, and this would be consistent with the rest of the finds (AFAIK). Are you getting a different behavior for, say arrays? eg "canFind([1, 2, 3], (int[]).init)" I don't have access to my compiler, so that's an actual question. If you *are* getting a different behavior, then I'd argue *that's* a bug. *: The only ambiguous case I see is if hasytack is empty, in which case I could see it both ways, but I'd still lean for "true", since "empty is empty", so "empty can be found inside empty". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------