best replacement for - cout << "hello D" << endl; ?

Bruce Adams tortoise_74 at ya.nos.pam.hoo.co.uk
Wed Jul 11 19:37:30 PDT 2007


Carlos Santander Wrote:

> Bruce Adams escribió:
> > 
> > and type safe compared to:
> > 
> > stdout.writefln("%s%s%i", foo,bar,2);
> > 
> 
> D has typesafe variadics, so you can just say:
> 
> dout.writefln("%s%s%s", foo,bar,2);
> 
> %s doesn't mean "pretend it's a string," but rather "write its string 
> representation."
> 
> -- 
> Carlos Santander Bernal

I see. That makes quite a lot of difference. Now is there a way to remove the format string entirely.
  a) as a function
  b) as a template that can be expanded at compile time.

It sounds like its trivial to write a) if it doesn't already exist. Hopefully, it does though.

Regards,

Bruce.



More information about the Digitalmars-d-learn mailing list