More uses of operator "in"

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 28 13:24:03 PDT 2014


On 10/28/14 3:45 PM, "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= 
<ola.fosheim.grostad+dlang at gmail.com>" wrote:
> On Tuesday, 28 October 2014 at 14:06:27 UTC, Steven Schveighoffer wrote:
>> On 10/28/14 9:50 AM, "Nordlöw" wrote:
>>> Has there been any proposals/plans to make operator "in" work for
>>> elements in ranges such as
>>>
>>>     assert('x' in ['x']);
>
>>
>> Your assertion requires O(n) performance.
>
> It is O(ln(n)) on a sorted array.

It's also O(lgn) on a sorted set, or O(1) on a hash set. So?

-Steve


More information about the Digitalmars-d-learn mailing list