Documentation: is it intentional that template constraints are displayed after the signature?
Ali Çehreli
acehreli at yahoo.com
Fri Nov 1 17:23:42 UTC 2019
On 11/01/2019 09:33 AM, Paul Backus wrote:
> On Friday, 1 November 2019 at 15:29:24 UTC, Ali Çehreli wrote:
>> Apparently, it's the version for static arrays. However, I don't think
>> the template constraint is doing anything there because if T matches a
>> static array (of the form U[n]), then T is not a struct anyway.
>>
>> Ali
>
> `T : U[n]` could also be matched by a struct with an `alias this` to a
> static array member.
>
> Example: https://run.dlang.io/is/NgRU94
Thanks. Is it special to destroy() to care for that case or should all
our algorithms be on the watchout for such structs? I'm sure I would be
missing that specialization if I ever needed to write similar
specializations for an algorithm.
Ali
More information about the Digitalmars-d-learn
mailing list