About the in expression, Why can't use with array.

Paul Backus snarwin at gmail.com
Thu Oct 24 13:04:56 UTC 2019


On Thursday, 24 October 2019 at 12:58:11 UTC, lili wrote:
> Hi:
>    In Dlang where is strange design. The in expression can only 
> use to associative array, why array can not use in expression.

Checking for the presence of an item in an array requires a 
linear search. You can do it with std.algorithm.searching.canFind:

https://dlang.org/phobos/std_algorithm_searching.html#.canFind


More information about the Digitalmars-d-learn mailing list