Non-consistent implicit function template specializations

Steven Schveighoffer schveiguy at gmail.com
Tue Aug 17 18:27:21 UTC 2021


On 8/17/21 2:07 PM, Rekel wrote:
> On Tuesday, 17 August 2021 at 16:24:38 UTC, Steven Schveighoffer wrote:

>> All these are calling with array literals, which default to dynamic 
>> arrays, not static arrays.
> 
> I realise that is their default, though in this scenario they should (I 
> believe) be used as static arrays. (This works for me in any case)

According to my tests, it prefers the `T` version over the static array 
version. Which leads me to believe that it prefers a dynamic array over 
a static one. In fact, if I comment out the `T` version, it doesn't 
compile. It literally will not pick that specialization, even if it can 
interpret the literal that way.

which is really bizarre, since if you do it without specializations, but 
just spelling out all the template components (as in your alternative 
workaround), it WILL pick that one over a dynamic array one.

-Steve


More information about the Digitalmars-d-learn mailing list