Enum type deduction inside templates is not working

Chris Nicholson-Sauls via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 27 07:34:52 PDT 2014


On Friday, 27 June 2014 at 07:43:27 UTC, Uranuz wrote:
> I don't know why I use D enough long but I did not remember 
> this fact.

Sometimes we get spoiled by all the amazing/nifty things that do 
work, and expect comparable things like this to Just Work.  To be 
honest, at first I didn't see any issue in what you were doing 
either...

One thing you could do in the meantime is to use an instantiator 
function.  This works just fine:


auto pair(F, S)(F f, S s)
{
     return Pair!(F, S)(f, s);
}


void main()
{
     auto p = pair(Category.first, "first");
     writeln(p);
}



More information about the Digitalmars-d-learn mailing list