std.algorithm.canFind behavior difference between arrays and elements

Seb seb at wilzba.ch
Fri Dec 7 20:28:37 UTC 2018


On Friday, 7 December 2018 at 19:38:29 UTC, Arun Chandrasekaran 
wrote:
> On Friday, 7 December 2018 at 19:12:31 UTC, Seb wrote:
>> On Friday, 7 December 2018 at 18:51:27 UTC, Arun 
>> Chandrasekaran wrote:
>>> [...]
>>
>> Alternatively to the answers above you can also use a custom 
>> lambda for canFind:
>>
>> https://run.dlang.io/is/QOXYbe
>
> Just curious, how do we find multiple needles? This throws 
> compilation error
>
>     assert(hay.canFind!(e => (e.canFind(["111", "222"]))));
>
> An example in the doc would be helpful.


It's variadic: https://run.dlang.io/is/AKkKA9

Please feel free to add an example to the docs.


More information about the Digitalmars-d-learn mailing list