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

Murilo murilomiranda92 at hotmail.com
Sun Oct 20 02:18:45 UTC 2019


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);
> }

Unfortunately I tested it here and it didn't work. The 
documentation also shows that it is not really what I am looking 
for. What I want is a function that checks if all the elements of 
one set are contained in another set, regardless of the order in 
which they are written.


More information about the Digitalmars-d mailing list