www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1998] New: std.bitarray should have setAll / opSliceAssign(bool) etc

http://d.puremagic.com/issues/show_bug.cgi?id=1998

           Summary: std.bitarray should have setAll / opSliceAssign(bool)
                    etc
           Product: D
           Version: 1.028
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: wbaxter gmail.com


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.


-- 
Apr 15 2008