June 14, 2004[Fix] Bit pointer/array implementation with bit offset
This is what I wrote in the limited spare time I had at the weekend. Two types: BitPointer, to use as bit*, and BitArray, to use as bit. Still not optimised, and I'm not sure if there are operations I've missed off (besides stuff with static bit arrays). It uses a bit offset to enable arbitrary bit pointing, in-place slicing and copying. And it even supports foreach with an inout iterator, which is another step up from the current imp IIRC. Of course, the representation isn't compatible with that of regular pointer and array types. But it can't be, if it's to achieve the argued-for functionality being implemented here. So obviously, there'd need to be restrictions/special handling on conversions to/from other pointer/array types.... Code attached, complete with unittests.... Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
Copyright © 1999-2016 by Digital Mars ®, All Rights Reserved