make

fnauto make(T, Allocator, A...)(auto ref Allocator alloc, auto ref A args)

Dynamically allocates (using alloc) and then creates in the memory allocated an object of type T, using args (if any) for its initialization. Initialization occurs in the memory allocated and is otherwise semantically the same as T(args). (Note that using alloc.make!(T[]) creates a pointer to an (empty) array of Ts, not an array. To use an allocator to allocate and initialize an array, use alloc.makeArray!T described below.)

Parameters

TType of the object being created.
allocThe allocator used for getting the needed memory. It may be an object implementing the static interface for allocators, or an IAllocator reference.
argsOptional arguments used for initializing the created object. If not present, the object is default constructed.

Returns

If T is a class type, returns a reference to the created T

object. Otherwise, returns a T* pointing to the created object. In all cases, returns null if allocation failed.

Throws

If T's constructor throws, deallocates the allocated memory and

propagates the exception.