Partial ordering of constructors with type parameters

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 23 23:02:52 PDT 2014


On Wednesday, 23 April 2014 at 22:07:32 UTC, John Colvin wrote:
> 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) {}
> }

*That* creates a conflict though :/


More information about the Digitalmars-d-learn mailing list