On 07/02/2014 07:35 AM, Vlad Levenfeld wrote:
On Wednesday, 2 July 2014 at 14:14:57 UTC, Dicebot wrote:
struct S
{
    int opIn_r(int key)
    {
        return key*2;
    }
}

void main()
{
    assert((42 in S.init) == 84);
}

Thanks! I wonder, why the _r

I think it is the old syntax, meaning "this is the overload for when an S object is on the right-hand side".

> and lack of documentation?

It appears in the binary operator table:

  http://dlang.org/operatoroverloading.html#Binary

Also see the section 'Inclusion query by opBinaryRight!"in"' here:

  http://ddili.org/ders/d.en/operator_overloading.html

Ali

Reply via email to