francesco cattoglio:

should this code compile? I understand that the literal "1" is "int" therefore it can screw type deduction, but I wonder if the compiler should be smart enough to deduce it correctly.

To keep both the compiler and programmers sane, D templates don't perform implicit type conversions. This sometimes is not handy, but on the whole saves from a large number of troubles.

So you can write (D V.2.066):

Vector!ubyte(ubyte(1), ubyte(1), ubyte(1));

Or you can create a little helper function that makes that code more DRY.

Bye,
bearophile

Reply via email to