mismatch and return value

celavek via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 13 02:59:30 PDT 2016


Hi,

I am trying to use the function "mismatch" from 
std.algorithm.comparison like so:

int count = 0;
auto m = mismatch(lhs, rhs);

while (!m[0].empty)
{
     ++count;
     m = mismatch(m[0], m[1]);
}

That goes into an infinite loop. What does mismatch return when 
it cannot
actually find a mismatch? Is the return value immutable?
I do not get any warnings from the compiler(dmd).

As a side note the documentation of the standard library is not
digestible to say the least - there is missing info(e.g. what 
does mismatch return
if no mismatch found) and lacks user-friendliness and details.


More information about the Digitalmars-d-learn mailing list