On Tuesday, 12 July 2016 at 18:52:08 UTC, Meta wrote:
On Tuesday, 12 July 2016 at 04:23:07 UTC, Adam Sansier wrote:
Now, I could simply make Do a template method but then this prevents it being a virtual function.

void Do(T)(T name) if (is(T == string) || is(T == int))
{
    Init_Data();

    static if (is(T == string))
    {
        ...Get index from name
    }

    ....
}

You could always use std.variant.algebraic which implements runtime polymorphism:

import std.algebraic;

Should be `import std.variant`.

Reply via email to