On Wednesday, 2 July 2014 at 14:35:55 UTC, 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 and lack of documentation?

Maybe something from old days? But in current <a
href="http://dlang.org/operatoroverloading.html#Binary";
target="_blank">doc</a> there is a opBinary:

struct S
{
     int opBinaryRight(string op : "in")(int key)
     {
         return key*2;
     }
}

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

Reply via email to