The OpenD Programming Language

BitArray.opSliceAssign

Sets all the values in the BitArray to the value specified by val.

  1. void opSliceAssign(bool val)
    struct BitArray
    @nogc pure nothrow @system
    void
    opSliceAssign
    (
    bool val
    )
  2. void opSliceAssign(bool val, size_t start, size_t end)

Examples

import std.algorithm.comparison : equal;

auto b = BitArray([1, 0, 1, 0, 1, 1]);

b[] = true;
// all bits are set
assert(b.bitsSet.equal([0, 1, 2, 3, 4, 5]));

b[] = false;
// none of the bits are set
assert(b.bitsSet.empty);

Meta