On Mar 1, 11 05:04, Simen kjaeraas wrote:
Adam Ruppe <destructiona...@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));


How are these better than

foo(/*width*/ 10, /*height*/ 20);

? One advantage of named parameter is the compiler can verify you've passed in the correct order, and all these alternatives cannot.

Reply via email to