InExpression with custom type?

Leandro Motta Barros lmb at stackedboxes.org
Fri Aug 23 13:15:25 PDT 2013


Thanks!

LMB


On Fri, Aug 23, 2013 at 4:59 PM, Namespace <rswhite4 at googlemail.com> wrote:

> On Friday, 23 August 2013 at 19:57:42 UTC, Leandro Motta Barros wrote:
>
>> Hello!
>>
>> Is it possible to make an InExpression work with a used-defined type?
>>
>> struct MyCollection { ... }
>>
>> MyCollection mc;
>>
>> auto p = 123 in mc;
>> if (p) { ... }
>>
>> Thanks!
>>
>> LMB
>>
>
> Yes, use opBinaryRight:
>
> T* opBinaryRight(stirng op : "in")(...)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130823/53813a08/attachment.html>


More information about the Digitalmars-d-learn mailing list