How about a function called contains() for the module std.array?

Murilo murilomiranda92 at hotmail.com
Sun Oct 20 02:56:14 UTC 2019


On Sunday, 20 October 2019 at 02:42:12 UTC, Arun Chandrasekaran 
wrote:
> On Sunday, 20 October 2019 at 02:19:06 UTC, Murilo wrote:
>> On Saturday, 19 October 2019 at 21:58:55 UTC, Adam D. Ruppe 
>> wrote:
>>> On Saturday, 19 October 2019 at 21:47:57 UTC, Murilo wrote:
>>>> I did not find such function
>>>
>>> It is called `canFind`
>>>
>>> http://dpldocs.info/experimental-docs/std.algorithm.searching.canFind.canFind.3.html
>>>
>>>
>>> import std.algorithm.searching;
>>> import std.stdio;
>>>
>>> void main() {
>>>         bool f = [1,2,3,4,5,6].canFind([3,5,6]);
>>>         writeln(f);
>>> }
>>
>> That unfortunately returned false.
>
> bool f = [1,2,3,4,5,6].canFind!(e => e.canFind([3,5,6]));

That triggered an error.


More information about the Digitalmars-d mailing list