unstd.lifetime

Functions for user-defined lifetime implementation.

Members

Functions

_assumeSafeCopyConstructFrom
void _assumeSafeCopyConstructFrom(T chunk, U from)
Undocumented in source. Be warned that the author may not have intended to support it.
callDestructors
void callDestructors(T t)

Calls the destructor of the given object, if any.

callPostblits
void callPostblits(T t)

Calls the postblit of the given object, if any.

constructFrom
void constructFrom(T chunk, Arg arg)

Constructs an object of type T in given chunk of uninitialized memory just like T t = arg;.

constructFromLiteral
void constructFromLiteral(S chunk, Args args)

Constructs an object of struct type S in given chunk of uninitialized memory just like auto s = S(args);.

destruct
void destruct(T t, bool resetInitialState)

Destructs t exactly the same way a compiler does in a case it goes out of scope. Also puts destructed object in its init state if resetInitialState is true, otherwise object state will be undefined (i.e. possibly invalid).

finalizeClassInstance
void finalizeClassInstance(T t, bool resetMemory)

Destroys the given class instance and puts it in an invalid state. It's used to destroy an object so that any cleanup which its destructor or finalizer does is done. It does not initiate a GC cycle or free any GC memory. It always zero class instance __vptr. If resetMemory is true it will also set class instance memory to its initial state so that it no longer references any other objects.

initializeClassInstance
void initializeClassInstance(C chunk, Args args)

Constructs an object of class type C at given reference to uninitialized memory just like auto c = new C(args); except given memory is used instead of allocating.

isFinalized
bool isFinalized(T t)

Determines whether class instance t is finalized.

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

Moves source into target.

setElementsToInitialState
void setElementsToInitialState(T[] arr)

Sets all elements of the passed dynamic array to its init state.

setToInitialState
void setToInitialState(T t)

Sets the passed object to its init state.

Properties

_unqual
ref _unqual [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
finalized
bool finalized [@property getter]

Determines whether class instance t is finalized.

Templates

forward
template forward(args...)

Forwards function arguments with saving ref-ness.

Meta

Authors

Denis Shelomovskij