Why do the same work about 'IndexOfAny' and 'indexOf' function?

FrankLike via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 7 08:52:20 PST 2015


> std.algorithm.find has several overloads, one of which takes 
> multiple needles. The same is true for std.algorithm.canFind
>
> Quoting from the relevant std.algorithm.find overload docs: 
> "Finds two or more needles into a haystack."

string strs ="hello.exe";
   string[] s =["lib","exe","a","dll"];
   auto a = canFind!(string,string[])(strs,s);
   writeln("a is ",a);
   string strsb ="hello.";
   auto b = canFind!(string,string[])(strsb,s);
   writeln("b is ",b);

Get error:
does not match template declaration canFind(alias pred = "a ==b")

you can test it.

Thank you.


More information about the Digitalmars-d-learn mailing list