The OpenD Programming Language

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.

  1. T[] makeArray(size_t length)
  2. T[] makeArray(size_t length, T init)
  3. T[] makeArray(R range)
    struct TypedAllocator(PrimaryAllocator, Policies...)
    T[]
    makeArray
    (
    T
    R
    )
    ()

Parameters

T

element type of the array being created

range R

range used for initializing the array elements

Return Value

Type: T[]

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.

Meta