core.lifetime

Functions 18

fnT * emplace(T)(T * chunk) @safe pure nothrowGiven 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....
fnT * emplace(T, Args...)(T * chunk, auto ref Args args) if (is(T == struct) || Args.length == 1)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 t...
fnT emplace(T, Args...)(T chunk, auto ref Args args) if (is(T == class))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...
fnT emplace(T, Args...)(void[] chunk, auto ref Args args) if (is(T == class))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 t...
fnT * emplace(T, Args...)(void[] chunk, auto ref Args args) if (!is(T == class))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...
fnvoid copyEmplace(S, T)(ref S source, ref T target) if (is(immutable S == immutable T)) @systemEmplaces 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 initi...
fnvoid move(T)(ref T source, ref T target)Moves `source` into `target`, via a destructive copy when necessary.
fnT move(T)(return scope ref T source)Ditto
private fnvoid moveImpl(T)(scope ref T target, return scope ref T source)
private fnT moveImpl(T)(return scope ref T source)
private fnT trustedMoveImpl(T)(return scope ref T source) @trusted
private fnvoid moveEmplaceImpl(T)(scope ref T target, return scope ref T source)
fnvoid moveEmplace(T)(ref T source, ref T target) @systemSimilar to move but assumes `target` is uninitialized. This is more efficient because `source` can be blitted over `target` without destroying or initializing it first.
private fnvoid wipe(T, Init...)(return scope ref T source, ref const scope Init initializer) if (!Init.length || ((Init.length == 1) && (is(immutable T == immutable Init[0])))) @trusted
fnT _d_newThrowable(T)() if (is(T : Throwable) && __traits(getLinkage, T) == "D") @trustedAllocate 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.
fnT _d_newclassT(T)() if (is(T == class)) @trustedCreate a new class instance. Allocates memory and sets fields to their initial value, but does not call a constructor. --- new C() // dnewclass!(C)() --- Returns: newly created object
fnT _d_newclassTTrace(T)(string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trustedTraceGC wrapper around dnewclassT.
fnT * _d_newitemT(T)() @trustedAllocate an initialized non-array item.

Variables 1

private enumvarhasContextPointers = { static if (__traits(isStaticArray, T)) { return hasContextPointers!(typeof(T.init[0])); } else static if (is(T == struct)) { import core.internal.traits : anySatisfy; return __traits(isNested, T) || anySatisfy!(hasContextPointers, typeof(T.tupleof)); } else return false; } ()

Templates 3

tmplforward(args...)

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

Parameters

argsa parameter list or an AliasSeq.

Returns

An AliasSeq of args with out, ref, and lazy saved.
tmpl_d_delstructImpl(T)

Implementation of _d_delstruct and _d_delstructTrace

Functions
void _d_delstructImpure(ref T p)
void _d_delstruct(ref T p)

This is called for a delete statement where the value being deleted is a pointer to a struct with a destructor but doesn't have an overloaded delete operator.

Parameters

ppointer to the value to be deleted

Bugs

This function template was ported from a much older runtime hook that

bypassed safety, purity, and throwabilty checks. To prevent breaking existing code, this function template is temporarily declared @trusted until the implementation can be brought up to modern D expectations.

tmplTypeInfoSize(T)