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

2017-07-15 Thread RedCAT via Digitalmars-d-learn
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;

Re: How to declare "abstract" delegates list?

2017-05-06 Thread RedCAT via Digitalmars-d-learn
On Saturday, 6 May 2017 at 06:07:01 UTC, bauss wrote: By theory that should work. It's untested, so you might need a few tweaks here and there. Thanks!

How to declare "abstract" delegates list?

2017-05-05 Thread RedCAT via Digitalmars-d-learn
Hello! Is it possible to create a list of slightly different delegates? For example, there is a class hierarchy: class Base; class DerivedOne : Base; class DerivedTwo : Base; And there are several delegates: void delegate(int, Base); void delegate(int, DerivedOne); void delegate(int,