Template parameter defaults

Johann MacDonagh johann.macdonagh..no at spam..gmail.com
Mon May 30 06:42:53 PDT 2011


I'm wondering if there's a cleaner way to do this:

class Test(T = uint)
{
     this(string s)
     {
     }
}

void main(string[] argv)
{
     auto a = new Test!()("test");
}

I'd *like* to be able to do this:

auto a = new Test("test");

and:

auto a = new Test!double("test");

The only possibility I see is to do this:

alias Test!() Test2;

But that introduces two types a user has to decide between. Any ideas? 
Am I out of luck here?

Thanks


More information about the Digitalmars-d-learn mailing list