Bug 1998 – std.bitarray should have setAll / opSliceAssign(bool) etc
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2008-04-15T23:26:54Z
Last change time
2017-12-18T22:54:37Z
Keywords
bootcamp
Assigned to
No Owner
Creator
Bill Baxter
Comments
Comment #0 by wbaxter — 2008-04-15T23:26:54Z
There are a number of things that could enhance BitArray's functionality:
* BitArray doesn't appear to have any way to set all bits to a given value efficiently.
The D'ish way would be to provide an opSliceAssign(bool val) and then you could do bitarr[] = true;
* It should probably support other slice operations as well, at least the basic opSlice, if not more general opSliceAssign.
* Also missing I think is a way to flip the bits in place.
If there were overloads for the numeric operators that did "broadcasting" then that would take care of it, because then you could do
bitarr ^= true;
to flip all the bits. By "broadcasting" I mean treat a single bool as if it were a BitArray containing that same bool value repeated N times.
Comment #1 by andrei — 2015-11-03T19:14:51Z
This applies to D2, marking it as such.
Comment #2 by razvan.nitu1305 — 2017-07-20T10:44:06Z