destruct

Destructs a class that's been previously constructed with construct() and when the static type is known.

The function calls the destructor and, when passed as reference, set the the instance to null. When the static type is not known, destruct must be called after a cast to Object.

  1. void destruct(auto ref T* instance)
  2. void destruct(ref T instance)
  3. void destruct(auto ref T instance)
    void
    destruct
    (
    bool assumeNoDtor = false
    T
    )
    (
    auto ref T instance
    )
    if (
    is(T == class) &&
    T.stringof != Object.stringof
    )
  4. void destruct(auto ref T instance)
  5. void destruct(auto ref T instance)
  6. void destruct(auto ref T* instance)

Parameters

assumeNoDtor

When no __ctor is found this avoids to search one in the base classes.

T

A class type (most derived), likely to be infered.

instance
Type: T

A T instance.

Meta