InExpression with custom type?

Namespace rswhite4 at googlemail.com
Fri Aug 23 12:59:31 PDT 2013


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")(...)


More information about the Digitalmars-d-learn mailing list