operator []= method

void operator []= (T index, bool value)

Sets the bit with the given index to the given value.

If value is true, the bit with the given index is set to one. Otherwise, the bit is set to zero.

Implementation

void operator []=(T index, bool value) {
  assert(index.index < _length);
  if (value)
    _bits = _bits | (1 << index.index);
  else
    _bits = _bits & ~(1 << index.index);
}