View source code
Display the source code in std/experimental/allocator/typed.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aBugzilla 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 usinglocal 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
Name | Description |
---|---|
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
Copyright © 1999-2025 by the D Language Foundation | Page generated by ddox.