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

Reply via email to