The OpenD Programming Language

BitArray.opCast

Convert to size_t[].

  1. inout(void)[] opCast()
  2. inout(size_t)[] opCast()
    struct BitArray
    inout @nogc pure nothrow
    inout(size_t)[]
    opCast
    (
    T : const size_t[]
    )
    ()

Examples

import std.array : array;
import std.range : repeat, take;

// bit array with 300 elements
auto a = BitArray(true.repeat.take(300).array);
size_t[] v = cast(size_t[]) a;
const blockSize = size_t.sizeof * 8;
assert(v.length == (a.length + blockSize - 1) / blockSize);

Meta