tern.typecons.automem

Wrappers for automatically managing memory.

Members

Classes

Disposable
class Disposable(T)

Automatically disposing wrapper, will attempt to dispose by calling close, dispose, or destroy if all else fails.

RefCounted
class RefCounted(T, alias FREE = typeof(null))

Counts references to the origin RefCounted and only releases if all references have also destructed.

Scoped
class Scoped(T, alias FREE = typeof(null))

Automatically releases a pointer of type T when exiting scope, allows any kind of ownership, but does not ref count.

Tracked
class Tracked(T, alias FREE = typeof(null))

Stores all pointers and sweeps through the array after a Tracked destructs.

Unique
class Unique(T, alias FREE = typeof(null))

Automatically releases a pointer of type T when exiting scope, assumes no ownership is passed.

Functions

disposable
Disposable!T disposable(T val)

Helper function for creating a disposable.

refCounted
RefCounted!T refCounted(T ptr)

Helper function for creating a ref counted.

scoped
Scoped!T scoped(T ptr)

Helper function for creating a scoped.

tracked
Tracked!T tracked(T ptr)

Helper function for creating a tracked.

unique
Unique!T unique(T ptr)

Helper function for creating a unique.

Meta