On Thu, 30 Dec 2010 19:17:09 +0100, Max Samukha <[email protected]> wrote:

On 12/30/2010 07:08 PM, Steven Schveighoffer wrote:


auto opAdd(Foo other)

vs.

auto opBinary(string op)(Foo other) if (op == "+")

For the latter not to look so intimidating, it can be shortened to:

auto opBinary(string op : "+")(Foo other)

Sadly, that shortcut does not allow for grouping. :(

Perhaps we could get a specialization for that, though:

auto opBinary( string op : "+" | "-" )( Foo other )

for instance.

--
Simen

Reply via email to