Documentation: is it intentional that template constraints are displayed after the signature?
Ali Çehreli
acehreli at yahoo.com
Fri Nov 1 15:29:24 UTC 2019
On 11/01/2019 04:09 AM, berni44 wrote:
> What I don't understand is the 4th version with two extra parameters.
> Here the documentation lacks an explanation, what this is good for.
I went to the documentation by clicking "View source code" and scrolled
a bit and found this:
https://github.com/dlang/druntime/blob/v2.088.1/src/object.d#L590
void destroy(bool initialize = true, T : U[n], U, size_t n)(ref T obj)
if (!is(T == struct))
{
foreach_reverse (ref e; obj[])
destroy!initialize(e);
}
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
More information about the Digitalmars-d-learn
mailing list