Variadic template parameters T... bounding

Marc Schütz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 2 07:08:09 PST 2016


On Tuesday, 2 February 2016 at 14:55:42 UTC, Daniel Kozak wrote:
> On Tuesday, 2 February 2016 at 14:47:43 UTC, Marc Schütz wrote:
>> if you mix ints and floats, the common type is deduced 
>> correctly:
>
> this is a bug for me :). I do not like this. I am ok with 
> (u)byte to int conversion and similar, but mixing float and 
> integral types does not seems to be OK.

I see. But it's also consistent with array type deduction 
elsewhere:

     auto a = [1, 2.5];
     pragma(msg, typeof(a));  // double[]

... and more importantly:

     class A { }
     class B : A { }
     class C : A { }
     auto a = [new A(), new B()];
     pragma(msg, typeof(a));  // A[]


More information about the Digitalmars-d-learn mailing list