easy way to output a struct?
Hoenir
mrmocool at gmx.de
Thu Jan 15 12:34:38 PST 2009
BCS schrieb:
> Reply to Hoenir,
>
>> Denis Koroskin schrieb:
>>
>>> One note is that you should probably pass the object by reference:
>>>
>>> void log(T)(ref T obj) { ... } // D1
>>> void log(T)(ref const(T) obj) { ... } // D2
>> Good idea. btw ref'ing a class has no effect, has it?
>>
>
> ref object would allow you to alter what the passed in argument is:
>
>
> void Fn(ref object o) { o = null; }
>
> object o = new Bah!();
> Fn(o);
> assert(o is null);
>
Oh, yeah of course, forgot that. Was just thinking of structs being
value and classes being reference types.
More information about the Digitalmars-d-learn
mailing list