On Wed, Jul 02, 2014 at 02:35:54PM +0000, Vlad Levenfeld via 
Digitalmars-d-learn 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?

Don't use opIn_r, that's a relic from D1. Instead, use this:

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


T

-- 
I think Debian's doing something wrong, `apt-get install pesticide', doesn't 
seem to remove the bugs on my system! -- Mike Dresser

Reply via email to