BitArray crash

Danny via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 30 15:17:26 PST 2015


Hi,

I'm trying to use BitArray instead of rolling my own. But how 
does one use it?

I tried:

import std.bitmanip : BitArray;

int main() {
	BitArray b;
	b[2] = true;
	return 0;
}

$ gdc l.d
$ gdb a.out
(gdb) r
Program received signal SIGSEGV, Segmentation fault.
0x0000000000438f88 in std.bitmanip.BitArray.opIndexAssign() 
(this=..., b=true,
     i=2) at ../../../../src/libphobos/src/std/bitmanip.d:604

Huh?

(gdc-4.8 (Ubuntu 4.8.2-19ubuntu1) 4.8.2)

I think I have to set "length" first. At least an example at the 
docs of bitsSet() halfway down the page does it...


More information about the Digitalmars-d-learn mailing list