initializeAll

Initializes all elements of range with their .init value. Assumes that the elements of the range are uninitialized.

  1. void initializeAll(Range range)
    void
    initializeAll
    (
    Range
    )
    (
    Range range
    )
  2. void initializeAll(Range range)

Parameters

range Range

An input range that exposes references to its elements and has assignable elements

Examples

import core.stdc.stdlib : malloc, free;

struct S
{
    int a = 10;
}

auto s = (cast(S*) malloc(5 * S.sizeof))[0 .. 5];
initializeAll(s);
assert(s == [S(10), S(10), S(10), S(10), S(10)]);

scope(exit) free(s.ptr);

See Also

Meta

Suggestion Box / Bug Report