Two easy pieces

Nick Treleaven ntrel-public at yahoo.co.uk
Tue Apr 2 06:33:32 PDT 2013


On 02/04/2013 01:10, bearophile wrote:
> Sometimes you want to print something coming out of a UFCS chain with a
> formatting string. In this case you can't append the writef/writefln at
> the end of the chain. The problem is easy to solve with two simple
> functions like this. Are they worth having in std.stdio?

I think usually the format string is known statically, so we could have 
a template overload of writef[ln] with a compile-time format parameter.

We can then use that overload for UFCS:

5.writefln!"hi %s!";


More information about the Digitalmars-d-learn mailing list