View source code
Display the source code in std/experimental/allocator/typed.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.experimental.allocator.typed.TypedAllocator.makeArray

Create an array of T with length elements. The array is either default-initialized, filled with copies of init, or initialized with values fetched from range.

T[] makeArray(T) (
  size_t length
);

T[] makeArray(T) (
  size_t length,
  auto ref T init
);

T[] makeArray(T, R) (
  R range
)
if (isInputRange!R);

Parameters

NameDescription
T element type of the array being created
length length of the newly created array
init element used for filling the array
range range used for initializing the array elements

Returns

The newly-created array, or null if either length was 0 or allocation failed.

Throws

The first two overloads throw only if the used allocator's primitives do. The overloads that involve copy initialization deallocate memory and propagate the exception if the copy operation throws.

Authors

License