Pretty please: Named arguments

Simen kjaeraas simen.kjaras at gmail.com
Mon Feb 28 13:04:20 PST 2011


Adam Ruppe <destructionator at gmail.com> wrote:

> Another alternative is to give each element their own struct...
>
> struct Width { int width; alias width this; }
>
> foo(Width(10), Height(20));

Clearly this can be done better:

struct _(string s) { int data; alias data this; }

foo(_!"width"(10), _!"height"(20));

-- 
Simen


More information about the Digitalmars-d mailing list