Profiling graph library
bearophile
bearophileHUGS at lycos.com
Wed Jul 31 05:22:51 PDT 2013
Joseph Rushton Wakeling:
> I take it you mean std.bitmanip.BitArray ... ?
Right.
> I ran into some interesting problems which are probably down to
> incomplete
> implementation: e.g.
>
> myBitArray.length += n;
>
> ... results in a compiler error message: myBitArray.length() is
> not an lvalue
This is just a missing feature. Someone should implement it.
std.bitmanip.BitArray lacks several small features.
> BitArrays are also not sliceable, it seems.
This is a bit more complex to implement in BitArray.
One way to implement it is to copy all the sliced data, with no
alignment, and create a new BitArray. But this is semantically
different from the regular array slicing (that doesn't copy data).
If you don't want to copy data then you have to add to BitArray a
field (one ubyte one uint, if you use an ubyte it needs a static
if for static safety) that represents the 0..(size_T.sizeof * 8)
offset. But this could slow down a bit the access of single bits.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list