Partial ordering of constructors with type parameters

John Colvin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 23 15:07:31 PDT 2014


On Wednesday, 23 April 2014 at 18:04:05 UTC, monarch_dodra wrote:
> If you can't update your compiler, an alternative is to make 
> your non-template version an actual template:
>
> class Foo{
>     this(T : int)(T x){}
>     this(T)(T x) {}
> }

I haven't tested, but wouldn't this be more precisely equivalent?:

class Foo{
     this()(int x){}
     this(T)(T x) {}
}


More information about the Digitalmars-d-learn mailing list