The empty statement ";" - when is it useful?

Jarrett Billingsley jarrett.billingsley at gmail.com
Tue Jul 28 11:45:12 PDT 2009


 Tue, Jul 28, 2009 at 2:28 PM, Arthur Lloyd<via at google.com> wrote:
> Daniel Keep Wrote:
>
>> U comma(T,U)(T a, U b) { return b; }
>>
>> Is there any reason you couldn't use something like that?
>
> Sorry, this is probably a newbie question, but.. So instead of return a, b, c; you now have to write return comma(a, comma(b, c)); ? How will that help?
>

typeof(T[$ - 1]) comma(T...)(T args) { return args[$ - 1]; }

There.  Now you can do "comma(a, b, c)".



More information about the Digitalmars-d mailing list