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
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:
- canFind typing bearophile
- Re: canFind typing Jonathan M Davis
- Re: canFind typing bearophile