numem.lifetime

Numem Lifetime Handling.

This module implements wrappers around numem.core.lifetime to provide an easy way to instantiate various D types and slices of D types.

Members

Functions

autoreleasepool
void autoreleasepool(void delegate() scope @(nogc) scope_)

Creates a scoped auto release pool.

autoreleasepool_scope
auto autoreleasepool_scope()

Creates a new auto release pool spanning the current scope.

copyTo
void copyTo(T from, T to)

Copies from to to via a blit operation.

cpp_delete
void cpp_delete(T obj_)

Finalizes obj_ by calling its destructor (if any).

cpp_delete
void cpp_delete(T[] objects)

Finalizes the objects referenced by objects by calling the destructors of its members (if any).

cpp_new
Ref!T cpp_new(Args args)

Allocates a new instance of T using the C++ allocation strategy.

cpp_trydelete
bool cpp_trydelete(T[] objects)

Attempts to finalize the objects referenced by objects by calling the destructors of its members (if any).

cpp_trydelete
bool cpp_trydelete(T obj_)

Attempts to finalize obj_ by calling its C++ destructor.

cpp_trynew
Ref!T cpp_trynew(Args args)

Attempts to allocate a new instance of T using the C++ allocation strategy.

move
T move(T from)

Moves from.

moveTo
void moveTo(T from, T to)

Moves from to to via a destructive copy.

nogc_construct
void nogc_construct(T object, Args args)

Constructs the given object.

nogc_copy
void nogc_copy(T[] dst, T[] src)

Copies src to dst via a blit operation.

nogc_delete
void nogc_delete(T obj_)

Finalizes obj_ by calling its destructor (if any).

nogc_delete
void nogc_delete(NuHeap heap, T obj_)

Deallocates the specified instance of T from the specified heap. Finalizes obj_ by calling its destructor (if any).

nogc_delete
void nogc_delete(T[] objects)

Finalizes the objects referenced by objects by calling the destructors of its members (if any).

nogc_emplace
void nogc_emplace(T dest, Args args)

Allocates a new class on the heap. Immediately exits the application if out of memory.

nogc_initialize
T nogc_initialize(void[] dst)

Initializes the object at the memory in dst, filling it out with its default state.

nogc_initialize
T nogc_initialize(T element)

Initializes the object at element, filling it out with its default state.

nogc_initialize
T[] nogc_initialize(T[] elements)

Initializes the objects at elements, filling them out with their default state.

nogc_move
void nogc_move(T[] dst, T[] src)

Moves elements in src to dst via destructive copy.

nogc_new
Ref!T nogc_new(Args args)

Allocates a new instance of T using the DLang allocation strategy.

nogc_new
Ref!T nogc_new(NuHeap heap, Args args)

Allocates a new instance of T using the DLang allocation strategy on the specified heap.

nogc_trydelete
bool nogc_trydelete(T obj_)

Attempts to finalize obj_ by calling its destructor (if any).

nogc_trydelete
bool nogc_trydelete(NuHeap heap, T obj_)

Attempts to deallocate the specified instance of T from the specified heap. Finalizes obj_ by calling its destructor (if any).

nogc_trydelete
bool nogc_trydelete(T[] objects)

Attempts to finalize the objects referenced by objects by calling the destructors of its members (if any).

nogc_trynew
Ref!T nogc_trynew(Args args)

Attempts to allocate a new instance of T using the DLang allocation strategy.

nogc_trynew
Ref!T nogc_trynew(NuHeap heap, Args args)

Attempts to allocate a new instance of T on the specified heap.

nogc_zeroinit
void nogc_zeroinit(T element)

Zero-fills an object

nogc_zeroinit
void nogc_zeroinit(T[] elements)

Zero-fills an object

nu_dup (from numem.core.memory)
inout(T)[] nu_dup(inout(T)[] buffer) via public import numem.core.memory : nu_dup, nu_idup, nu_resize, nu_malloca, nu_freea, nu_terminate, nu_swap;

Creates a shallow duplicate of the given buffer.

nu_freea (from numem.core.memory)
void nu_freea(T[] slice) via public import numem.core.memory : nu_dup, nu_idup, nu_resize, nu_malloca, nu_freea, nu_terminate, nu_swap;

Frees a slice.

nu_idup (from numem.core.memory)
immutable(T)[] nu_idup(inout(T)[] buffer) via public import numem.core.memory : nu_dup, nu_idup, nu_resize, nu_malloca, nu_freea, nu_terminate, nu_swap;

Creates a shallow immutable duplicate of the given buffer.

nu_malloca (from numem.core.memory)
T[] nu_malloca(size_t count) via public import numem.core.memory : nu_dup, nu_idup, nu_resize, nu_malloca, nu_freea, nu_terminate, nu_swap;

Allocates and initializes a new slice.

nu_resize (from numem.core.memory)
T[] nu_resize(T[] buffer, size_t length, int alignment) via public import numem.core.memory : nu_dup, nu_idup, nu_resize, nu_malloca, nu_freea, nu_terminate, nu_swap;

Resizes a slice to be of the given size and alignment. If the slice is not yet allocated, it will be.

nu_swap (from numem.core.memory)
void nu_swap(T a, T b) via public import numem.core.memory : nu_dup, nu_idup, nu_resize, nu_malloca, nu_freea, nu_terminate, nu_swap;

Swaps around 2 values of the same type.

nu_terminate (from numem.core.memory)
inout(T)[] nu_terminate(inout(T)[] text) via public import numem.core.memory : nu_dup, nu_idup, nu_resize, nu_malloca, nu_freea, nu_terminate, nu_swap;

Appends a null terminator at the end of the string, resizes the memory allocation if need be.

Structs

nu_autoreleasewith (from numem.core.lifetime)
struct nu_autoreleasewith(alias handlerFunc) via public import numem.core.lifetime : nu_destroywith, nu_autoreleasewith;

UDA which allows specifying which functions numem should call when autoreleasing an object with nu_autorelease.

nu_destroywith (from numem.core.lifetime)
struct nu_destroywith(alias handlerFunc) via public import numem.core.lifetime : nu_destroywith, nu_autoreleasewith;

UDA which allows specifying which functions numem should call when destroying an object with destruct.

See Also

Meta

Authors

Luna Nielsen