More uses of operator "in"

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 28 07:06:27 PDT 2014


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']);
>
> I'm missing that Python feature when I work in D.

No. The implication of 'in' for AAs is that it is a fast, O(lgn) or 
better, operation. Your assertion requires O(n) performance.

-Steve


More information about the Digitalmars-d-learn mailing list