Hopefully not-too-obvious observation

Simen Kjaeraas simen.kjaras at gmail.com
Thu Jul 18 03:36:52 PDT 2013


On 2013-07-18, 04:50, Jerry wrote:

> Hi folks,
>
> I was looking at writing a hash-like class with a specific operator and
> disliking the syntax of:
>
> T opBinary(string op)(U key) if (op == "in") {}
>
> When it occurred to me that it could be simply tightened up as:
>
> T opBinary(string op : "in")(U key) {}
>
> Any thoughts?  Is this bad style?

It's how I write my operator overloads unless the function should match
several of them.

So no, I think it's good style. But that's just, like, my opinion, man.

--
  Simen


More information about the Digitalmars-d mailing list