Re: Overriding "in" operator

2011-03-04 Thread Ali Çehreli
On 03/04/2011 10:41 AM, Magnus Lie Hetland wrote: On 2011-03-04 18:08:08 +0100, spir said: Didn't even know 'in' can be defined with opBinary... I use opIn_r ('r' for right side, since the container stand on the right of the expression) everywhere, and it works fine. Huh. Cool. Works like a c

Re: Overriding "in" operator

2011-03-04 Thread Magnus Lie Hetland
On 2011-03-04 18:08:08 +0100, spir said: Didn't even know 'in' can be defined with opBinary... I use opIn_r ('r' for right side, since the container stand on the right of the expression) everywhere, and it works fine. Huh. Cool. Works like a charm. Seems cleaner like the opBinaryRight soluti

Re: Overriding "in" operator

2011-03-04 Thread spir
On 03/04/2011 05:01 PM, Magnus Lie Hetland wrote: I'm writing a collection with functionality for membership checking. I thought it would be nice to use the "in" operator. In the docs for std.collections I surmise that this is the standard way to go. From the source code, I see there's no special

Re: Overriding "in" operator

2011-03-04 Thread Simen kjaeraas
Magnus Lie Hetland wrote: On 2011-03-04 17:06:29 +0100, Mafi said: If you try to use it in the manner of `something in classWhichDefinesThisOpBinary` then it doesn't work because operator overloading normally overloads on the left operand (ie something). Use opBinaryRight(string op)(...)

Re: Overriding "in" operator

2011-03-04 Thread Magnus Lie Hetland
On 2011-03-04 17:06:29 +0100, Mafi said: If you try to use it in the manner of `something in classWhichDefinesThisOpBinary` then it doesn't work because operator overloading normally overloads on the left operand (ie something). Use opBinaryRight(string op)(...) if(...) to get it working. Aa

Re: Overriding "in" operator

2011-03-04 Thread Mafi
Am 04.03.2011 17:01, schrieb Magnus Lie Hetland: I'm writing a collection with functionality for membership checking. I thought it would be nice to use the "in" operator. In the docs for std.collections I surmise that this is the standard way to go. From the source code, I see there's no special

Overriding "in" operator

2011-03-04 Thread Magnus Lie Hetland
I'm writing a collection with functionality for membership checking. I thought it would be nice to use the "in" operator. In the docs for std.collections I surmise that this is the standard way to go. From the source code, I see there's no special opIn, but that it can be done with the more gen