The OpenD Programming Language

BitArray.opOpAssign

Support for operator ~= for BitArray. Warning: This will overwrite a bit in the final word of the current underlying data regardless of whether it is shared between BitArray objects. i.e. D dynamic array concatenation semantics are not followed

  1. BitArray opOpAssign(BitArray e2)
  2. BitArray opOpAssign(bool b)
    struct BitArray
    pure nothrow return scope
    opOpAssign
    (
    string op
    )
    (
    bool b
    )
    if (
    op == "~"
    )
  3. BitArray opOpAssign(BitArray b)
  4. void opOpAssign(size_t nbits)
  5. void opOpAssign(size_t nbits)

Examples

bool[] ba = [1,0,1,0,1];

auto a = BitArray(ba);
BitArray b;

b = (a ~= true);
assert(a[0] == 1);
assert(a[1] == 0);
assert(a[2] == 1);
assert(a[3] == 0);
assert(a[4] == 1);
assert(a[5] == 1);

assert(b == a);
bool[] ba = [1,0];
bool[] bb = [0,1,0];

auto a = BitArray(ba);
auto b = BitArray(bb);
BitArray c;

c = (a ~= b);
assert(a.length == 5);
assert(a[0] == 1);
assert(a[1] == 0);
assert(a[2] == 0);
assert(a[3] == 1);
assert(a[4] == 0);

assert(c == a);

Meta