canFind typing
bearophile
bearophileHUGS at lycos.com
Thu Nov 29 06:28:56 PST 2012
I have used std.algorithm.canFind with different tuple types by
mistake, and the compiler has not complained. So to show it I
have written some reduced code that uses just numbers:
import std.algorithm: canFind;
void main() {
int[] arr1 = [1, 2];
double x1 = 2.0;
assert(arr1.canFind(x1));
double[] arr2 = [1.0, 2.0];
int x2 = 2;
assert(arr2.canFind(x2));
}
Are both of those canFind calls acceptable?
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list