mismatch and return value
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 13 03:41:44 PDT 2016
On Wednesday, 13 July 2016 at 09:59:30 UTC, celavek wrote:
> That goes into an infinite loop.
sure. let's read the docs: "Returns a tuple with the reduced
ranges that start with the two mismatched values." so, if it will
find mismatch, it will loop forever then, as you forgot to pop
one of the values, making `mismatch` to infinitely return with
the same ranges.
> What does mismatch return when it cannot
> actually find a mismatch?
let's read the doc again: "Returns a tuple with the reduced
ranges that start with the two mismatched values." simple logic
allows us to guess that it should return tuple with two empty
ranges. and it really does.
> Is the return value immutable?
as with most other std.algo functions, the returned range has
same properties as source range.
More information about the Digitalmars-d-learn
mailing list