How to turn an inout(Object) into a string

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 25 20:09:16 PDT 2015


The following code spits out pages of error messages, and it's 
driving me insane. I know that Object.toString only has a mutable 
variant, so how am I supposed to use writeln, toString, etc. with 
an inout, const, or immutable object?

void main(inout string[] args)
{
	import std.stdio;
	
	immutable(Object) o = new immutable Object();
         //Compile error: template instance
         //std.format.formatGeneric!(
         //        LockingTextWriter, immutable(Object),
         //        char)
         //error instantiating
	writeln(o);
}


More information about the Digitalmars-d-learn mailing list