How about a Hash template?

Jacob Carlborg doob at me.com
Fri Apr 29 02:31:39 PDT 2011


On 2011-04-28 18:20, Andrej Mitrovic wrote:
> Well, DMD accepts this kind of syntax already:
>
> if (value == val1, val2, val3) { }
>
> I think this turns the expression value==val1 into a bool, and then
> turns val2 and val3 into bools and compares against each of them. Or
> something like that. It's odd and I've never seen it used anywhere.
>
> Maybe we could put that syntax into good use.

Wouldn't it be nice if you could do something like this:

if (value == (3 || 4)) {}

And the compiler turns that into:

if (value == 3 || value == 4) {}

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list