core.lifetime

Undocumented in source.

Members

Functions

_d_newThrowable
T _d_newThrowable()

Allocate an exception of type T from the exception pool. T must be Throwable or derived from it and cannot be a COM or C++ class.

_d_newclassT
T _d_newclassT()

Create a new class instance. Allocates memory and sets fields to their initial value, but does not call a constructor.

_d_newclassTTrace
T _d_newclassTTrace(string file, int line, string funcname)

TraceGC wrapper around core.lifetime._d_newclassT.

_d_newitemT
T* _d_newitemT()

Allocate an initialized non-array item.

_d_newitemTTrace
T* _d_newitemTTrace(string file, int line, string funcname)

TraceGC wrapper around core.lifetime._d_newitemT.

copyEmplace
void copyEmplace(S source, T target)

Emplaces a copy of the specified source value into uninitialized memory, i.e., simulates T target = source copy-construction for cases where the target memory is already allocated and to be initialized with a copy.

emplace
T* emplace(T* chunk)

Given a pointer chunk to uninitialized memory (but already typed as T), constructs an object of non-class type T at that address. If T is a class, initializes the class reference to null.

emplace
T* emplace(T* chunk, Args args)

Given a pointer chunk to uninitialized memory (but already typed as a non-class type T), constructs an object of type T at that address from arguments args. If T is a class, initializes the class reference to args[0]. This function can be @trusted if the corresponding constructor of T is @safe.

emplace
T emplace(T chunk, Args args)

Given a raw memory area chunk (but already typed as a class type T), constructs an object of class type T at that address. The constructor is passed the arguments Args. If T is an inner class whose outer field can be used to access an instance of the enclosing class, then Args must not be empty, and the first member of it must be a valid initializer for that outer field. Correct initialization of this field is essential to access members of the outer class inside T methods. Note: This function is @safe if the corresponding constructor of T is @safe.

emplace
T emplace(void[] chunk, Args args)

Given a raw memory area chunk, constructs an object of class type T at that address. The constructor is passed the arguments Args. If T is an inner class whose outer field can be used to access an instance of the enclosing class, then Args must not be empty, and the first member of it must be a valid initializer for that outer field. Correct initialization of this field is essential to access members of the outer class inside T methods. Preconditions: chunk must be at least as large as T needs and should have an alignment multiple of T's alignment. (The size of a class instance is obtained by using __traits(classInstanceSize, T)). Note: This function can be @trusted if the corresponding constructor of T is @safe.

emplace
T* emplace(void[] chunk, Args args)

Given a raw memory area chunk, constructs an object of non-class type T at that address. The constructor is passed the arguments args, if any. Preconditions: chunk must be at least as large as T needs and should have an alignment multiple of T's alignment. Note: This function can be @trusted if the corresponding constructor of T is @safe.

move
void move(T source, T target)
T move(T source)

Moves source into target, via a destructive copy when necessary.

moveEmplace
void moveEmplace(T source, T target)

Similar to move but assumes target is uninitialized. This is more efficient because source can be blitted over target without destroying or initializing it first.

Templates

_d_delstructImpl
template _d_delstructImpl(T)

Implementation of _d_delstruct and _d_delstructTrace

forward
template forward(args...)

Forwards function arguments while keeping out, ref, and lazy on the parameters.

Meta