Documentation: is it intentional that template constraints are displayed after the signature?

berni44 dlang at d-ecke.de
Fri Nov 1 11:09:53 UTC 2019


On Thursday, 31 October 2019 at 13:34:35 UTC, Tobias Pankrath 
wrote:
> I was confused at first by the trailing
>
>  if (!is(T == struct) && !is(T == interface) && !is(T == class) 
> && !__traits(isStaticArray, T));

I understood your question different from what Dennis answered. 
At least I was confused by similar lines, when I was a beginner 
and did not know much about template constraints. What I would 
have needed to know at that time is, that template constraints 
limit the situations, where the template can be used. Here for 
example, this destroy template can only be used, when the type T 
is neither struct, interface nor class (these three have separate 
instances, probably because they need different treatment) and 
it's also not a static array, for unknown reasons.

What I don't understand is the 4th version with two extra 
parameters. Here the documentation lacks an explanation, what 
this is good for.


More information about the Digitalmars-d-learn mailing list