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.