Changeing return type of struct.toString()
code at benjamin-thaut.de
Mon Feb 13 05:40:20 PST 2012
Am 13.02.2012 13:26, schrieb Stewart Gordon:
> On 13/02/2012 02:21, Don wrote:
>> I don't know why struct toString() still exists.
> What are you talking about? If you define a struct, it doesn't have any
> methods other than the ones you put into it.
void main(string args)
auto ti = cast(TypeInfo_Struct)typeid(fun);
If you change the return type of toString() to int for example the
program will crash because ti.xtoString will be null. Therefore the
compiler seems to check what type toString() does return and only fills
the type info if it actually does return a string.
More information about the Digitalmars-d