System::Collections::BitArray class

BitArray class

Array of bits which can be addressed by index. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

class BitArray : public virtual System::Object,
                 public System::Collections::Generic::ICollection<bool>

Nested classes

Methods

MethodDescription
Add(const bool&) overrideAdds value to the end of container.
And(const BitArrayPtr&)Calculates bitwise ‘and’ between two BitSets.
BitArray(const bitset&)Copy constructor.
BitArray(const BitArray&)Copy constructor.
BitArray(const BitArrayPtr&)Copy constructor.
BitArray(const System::ArrayPtr<bool>&)Copy constructor.
BitArray(const System::ArrayPtr<uint8_t>&)Copy constructor.
BitArray(const System::ArrayPtr<int>&)Copy constructor.
BitArray(int, bool)Fill constructor.
Clear() overrideDeletes all elements.
Contains(const bool&) const overrideChecks whether specific value is present in container. Not implemented.
CopyTo(System::ArrayPtr<bool>, int) overrideCopies data to existing array elements.
data()Underlying data structure access.
data() constUnderlying data structure access.
Get(int) constGets BitArray element.
get_Count() const overrideGets container size.
get_Length() constGets container size.
GetEnumerator() overrideCreates enumerator object.
idx_get(int) constGetter function.
idx_set(int, bool)Setter function.
Not()Negates BitSet.
operator!=(const BitArray&) constBitwise comparison operator.
operator==(const BitArray&) constBitwise comparison operator.
operator[](int)Accessor function.
Or(const BitArrayPtr&)Calculates bitwise ‘or’ between two BitSets.
Remove(const bool&) overrideReturns first occurance of specified value. Not implemented.
Set(int, bool)Sets BitArray element.
SetAll(bool)Sets all elements to specific value.
SetTemplateWeakPtr(uint32_t) overrideFormal implementation of weak template arguments mechanism; inapplicable to this class.
virtualizeBeginConstIterator() const overrideGets the implementation of begin const iterator for the current container.
virtualizeBeginIterator() overrideGets the implementation of begin iterator for the current container.
virtualizeEndConstIterator() const overrideGets the implementation of end const iterator for the current container.
virtualizeEndIterator() overrideGets the implementation of end iterator for the current container.
Xor(const BitArrayPtr&)Calculates bitwise ‘xor’ between two BitSets.

Typedefs

TypedefDescription
bitsetRTTI information.

Remarks

#include <system/collections/bitarray.h>
#include <system/smart_ptr.h>

using namespace System;
using namespace System::Collections::Generic;

void Print(const System::SmartPtr<System::Collections::Generic::IEnumerable<bool>> &bitArray)
{
  for (const auto item: bitArray)
  {
    std::cout << item << ' ';
  }
  std::cout << std::endl;
}

int main()
{
  // Constructs a new instance of the BitArray class.
  auto bitArray = MakeObject<System::Collections::BitArray>(3);

  // Print values.
  Print(bitArray);

  return 0;
}
/*
This code example produces the following output:
0 0 0
*/

See Also