[Issue 5042] format("%s") of struct without toString
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Apr 24 19:06:32 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5042
--- Comment #5 from bearophile_hugs at eml.cc 2012-04-24 19:07:34 PDT ---
(In reply to comment #4)
> After all, you should use std.string.xformat instead of std.string.format in
> 2.060 and later.
Thank you Hara, this works:
import std.stdio: writeln, writefln;
import std.string: xformat;
struct Foo { int x; }
void main() {
writeln(Foo(1)); // ==> Foo(1)
writefln("%s", Foo(1)); // ==> Foo(1)
writeln(xformat("%s", Foo(1))); // ==> Foo(1)
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list