Re: Why D have two function contains and canFind?

2017-07-24 Thread Timon Gehr via Digitalmars-d-learn
On 24.07.2017 20:19, Suliman wrote: Why D have two function `contains` and `canFind` `contains` guarantees logarithmic running time, while `canFind` can be linear.

Re: Why D have two function contains and canFind?

2017-07-24 Thread Seb via Digitalmars-d-learn
On Monday, 24 July 2017 at 19:53:34 UTC, Cym13 wrote: On Monday, 24 July 2017 at 18:31:09 UTC, Ali Çehreli wrote: On 07/24/2017 11:19 AM, Suliman wrote: > [...] only > [...] std.algorithm.canFind and std.range.SortedRange.contains: [...] I'm gessing this predates design by introspection as

Re: Why D have two function contains and canFind?

2017-07-24 Thread Cym13 via Digitalmars-d-learn
On Monday, 24 July 2017 at 18:31:09 UTC, Ali Çehreli wrote: On 07/24/2017 11:19 AM, Suliman wrote: > [...] only > [...] std.algorithm.canFind and std.range.SortedRange.contains: [...] I'm gessing this predates design by introspection as it would be cleaner to let the compiler do the switch

Re: Why D have two function contains and canFind?

2017-07-24 Thread Ali Çehreli via Digitalmars-d-learn
On 07/24/2017 11:19 AM, Suliman wrote: > Why D have two function `contains` and `canFind` if C# have only > contains and it's enough? std.algorithm.canFind and std.range.SortedRange.contains: https://dlang.org/phobos/std_algorithm_searching.html#.canFind https://dlang.org/

Why D have two function contains and canFind?

2017-07-24 Thread Suliman via Digitalmars-d-learn
Why D have two function `contains` and `canFind` if C# have only contains and it's enough?