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);
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