defining "in" What is the proper way in D2?

Timon Gehr timon.gehr at gmx.ch
Sun Sep 11 18:02:24 PDT 2011


On 09/12/2011 02:53 AM, Charles Hixson wrote:
> On 09/11/2011 04:07 PM, Timon Gehr wrote:
>> How do you mean, instantiate it?
>>
> container.binaryOp("in")!(something I haven't figured out yet.
>
> Template syntax doesn't make any sense to me yet. I'm just copying
> examples and adapting them with a cut and try and see what works and
> what doesn't. More failures than successes.
>
> OTOH, it does seem better than C++ template syntax, but that's VERY
> faint praise indeed.
>

You can explicitly instantiate it like this:

container.opBinaryRight!"in"(elem);

but you should be able to write

elem in container

instead, which is the same thing.




More information about the Digitalmars-d-learn mailing list