How do I use TBitArray assignment operator?

This doesn’t appear to work.

    TBitArray<FDefaultBitArrayAllocator> tempBtAr; //Small array for testing
    TBitArray<FDefaultBitArrayAllocator> listBtAr; //list of values to assign from

for(i = 0; i < 100; i++)
{
if(i % 2 == 0)
      listBtAr.Add(true)
else
      listBtAr.Add(false)
}
    
    tempBtAr.Init(false, 2); //Set array to a size of three with false values.
    
    tempBtAr[0] = listBtAr[someEvenIndex]; 
    tempBtAr[1] = listBtAr[someOddIndex];

This does.

TBitArray<FDefaultBitArrayAllocator> tempBtAr;
TBitArray<FDefaultBitArrayAllocator> listBtAr;

for(i = 0; i < 100; i++)
{
if(i % 2 == 0)
      listBtAr.Add(true)
else
      listBtAr.Add(false)
}       
    
    tempBtAr.Add(listBtAr[someEvenIndex]); 
    tempBtAr.Add(listBtAr[someOddIndex]); 

Am I using this incorrectly? Is it possible to access a specific TBitArray index and change the value?

I just tried this and it works?

      bool a = listBtAr[someEvenIndex];
		bool b = listBtAr[someOddIndex];
		tempBits[0] = a;
		tempBits[1] = b;

What would stop me from assigning between array indices versus the above?

sorry for necro, but here is how you use that good stuff statically: (for future readers)


TStaticBitArray&lt8>  flags; //8 will be the size of the array. you can set other sizes also.
flags[1]=true; //set 1st bit
flags[2] //get 2nd bit

usually TStaticBitArray is what you, developer, would look for. it is similar to std::bitset