How to initialize the Variant variable with the default value using TypeInfo?

RedCAT via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 15 09:27:26 PDT 2017


I have only TypeInfo taken dynamically from an arbitrary type, 
and I need to initialize the Variant variable to the default 
value for this type. How can I do that?

I tried this:

TypeInfo ti = typeid(int);
Variant v = ti.initializer;

But after,

int o = v.get!int;

and

int o = v.coerce!int;

doesn't work.




More information about the Digitalmars-d-learn mailing list