static bool[] ba = [1,0,1]; auto a = StaticBitArray!3(ba); size_t i; foreach (immutable b; a[]) // TODO is `opSlice` the right thing? { switch (i) { case 0: assert(b == true); break; case 1: assert(b == false); break; case 2: assert(b == true); break; default: assert(0); } i++; } foreach (j, b; a) // TODO is `opSlice` the right thing? { switch (j) { case 0: assert(b == true); break; case 1: assert(b == false); break; case 2: assert(b == true); break; default: assert(0); } }
Support for foreach loops for StaticBitArray.