[Issue 4124] New: toString() for BitArray and more

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 24 16:26:14 PDT 2010


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

           Summary: toString() for BitArray and more
           Product: D
           Version: future
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-04-24 16:26:12 PDT ---
A toString() method for std.bitmanip.BitArray is useful. It can use a simple
representation like the Python bitarray:

0101001010100001

Or as java.util.BitSet (but I prefer the Python version):

{1, 3, 6, 8, 10, 15} 


Other methods useful for BitArray:
- reset all bits
- set all bits
- are all bit set?
- are all bit reset?
- count set bits (there are _very_ efficient algorithms to do this).
- set n-th bit (this can be a little more efficient than bs[n]=1;)
- reset n-th bit (this can be a little more efficient than bs[n]=1;)
- flip n-th bit


I think the sort() method of BitArray is not commonly useful.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list