Odd to!string call
Pelle
pelle.mansson at gmail.com
Sun Dec 26 15:30:26 PST 2010
On 12/21/2010 07:38 PM, Andrej Mitrovic wrote:
> I found this by accident:
>
> import std.stdio;
> import std.conv;
>
> void main()
> {
> writeln(to!string(2, 2)); // writes 10
> writeln(to!string(1, 0)); // std.conv.ConvException: Radix error
> }
>
> I'm not sure why "std.conv.to" would even take multiple arguments. Bugzilla?
to! does some fancy stuff, like here:
auto myarr = [1,2,3];
writeln(to!string(myarr, "myarr:\n", "\n", "\n-----\n");
will write (untested, but should work :-)
myarr:
1
2
3
-----
I find this most useful a lot of the time.
More information about the Digitalmars-d-learn
mailing list