std.algorithm.canFind behavior difference between arrays and elements

Arun Chandrasekaran aruncxy at gmail.com
Sat Dec 8 07:33:41 UTC 2018


On Friday, 7 December 2018 at 20:28:37 UTC, Seb wrote:
> 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.

Sure, here it is https://github.com/dlang/phobos/pull/6796


More information about the Digitalmars-d-learn mailing list