BitArray new design

Era Scarecrow rtcvb32 at yahoo.com
Wed Jan 9 13:16:36 PST 2013


On Wednesday, 9 January 2013 at 20:00:59 UTC, Era Scarecrow wrote:
> BitString {
>   //bitfields for start/ending
>   size_t[]* bulkRaw; //pointer to the array?
>   //binaryOperators and opIndex, etc
>   //length modifier, but no memory re-allocation allowed
> }
>
> BitArray {
>   BitString array;
>   size_t[] rawMemory;
>   alias array this;
>   //include length modifiers and dynamic allocation
>   void init() {}
>   //opCast can convert to BitArrayFixed?
> }

  Hmm as I'm thinking about it more, a mixin for BitString may be 
better..

//    'size_t[] bulkRaw' required by enclosing struct/class
   mixin template BitString() {
     struct BitString {
     }
   }

   BitArray {
     mixin BitString;
     size_t[] bulkRaw;

     BitString array;
     alias array this;

     //length setter, handling allocation/reallocation
   }

   //since BitArray and BitArrayFixed may have different 
pointer/setups?
   //Or would either work together?
   BitArrayRange(BS, bool isConst) {
     BS* bitString;
   }

   If anyone wants to talk live with me, I tend to be on YIM, so 
rtcvb32 or Era_Scarecrow.


More information about the Digitalmars-d-learn mailing list