static struct WithDtor { private size_t* counter; ~this() @nogc nothrow pure { if (this.counter !is null) { ++(*this.counter); } } } size_t counter; WithDtor[2] withDtor = [WithDtor(&counter), WithDtor(&counter)]; destroyAll(withDtor[]); assert(counter == 2);
Destroys all elements in the range.
This function has effect only if the element type of Range has an elaborate destructor, i.e. it is a $(D_PSYMBOL struct) with an explicit or generated by the compiler destructor.