This is SO crazy. D has variable template args!

Craig Black cblack at ara.com
Thu Jul 12 11:21:36 PDT 2007


I agree with most that the use of << and >> or other forms of operator 
overloading are inappropriate to process variable number of arguments.  D 
has variable template args built in to the freakin language.  It's typesafe, 
elegant, and straightforward.

// C++ yuck
cout << "x is " << x << endl;

// Tango yuck
Stdout("x is ")(x).newline;

// Would be best and very easy to implement
write("x is ", x, newline);

-Craig 




More information about the Digitalmars-d-learn mailing list