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

Charles Hixson charleshixsn at earthlink.net
Sun Sep 11 22:52:39 PDT 2011


On 09/11/2011 06:02 PM, Timon Gehr wrote:
> 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.
>
>

Thanks, both for the reassurance, and for the alternate syntax.



More information about the Digitalmars-d-learn mailing list