[#BloombergLP-bdlc-BitArray] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlc.adoc[bdlc]::BitArray :relfileprefix: ../../ :mrdocs: Efficient, value‐semantic contiguous array of boolean (bit) values. == Synopsis Declared in `<bdlc_bitarray.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class BitArray; ---- == Description This class implements an efficient, value‐semantic array of boolean (a.k.a. bit, i.e., binary digit) values stored in contiguous memory. The physical capacity of this array may grow, but never shrinks. Capacity may be reserved initially via a constructor, or at any time thereafter by using the `reserveCapacity` method; otherwise, capacity will be increased automatically as needed. Note that capacity is not a _salient_ attribute of this object, and, as such, does not contribute to overall value. Also note that this class provides an implicit no‐throw guarantee for all methods (including manipulators) that do not attempt to alter capacity. == Enums [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/BitArray/_04enum.adoc[`Unnamed enum`] | Constants describing the storage representation of a `BitArray`. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/BitArray/2constructor-011.adoc[`BitArray`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlc/BitArray/2destructor.adoc[`~BitArray`] [.small]#[destructor]# | Destroy this object. | xref:BloombergLP/bdlc/BitArray/operator_assign.adoc[`operator=`] | Assign to this array the value of the specified `rhs` array, and return a non‐`const` reference to this array. | xref:BloombergLP/bdlc/BitArray/allocator.adoc[`allocator`] | Return the allocator used by this object to supply memory. | xref:BloombergLP/bdlc/BitArray/andEqual-04.adoc[`andEqual`] | `andEqual` overloads | xref:BloombergLP/bdlc/BitArray/append-0b.adoc[`append`] | `append` overloads | xref:BloombergLP/bdlc/BitArray/assign-01.adoc[`assign`] | `assign` overloads | xref:BloombergLP/bdlc/BitArray/assign0-00.adoc[`assign0`] | `assign0` overloads | xref:BloombergLP/bdlc/BitArray/assign1-0d.adoc[`assign1`] | `assign1` overloads | xref:BloombergLP/bdlc/BitArray/assignAll.adoc[`assignAll`] | Set all bits in this array to the specified `value`. | xref:BloombergLP/bdlc/BitArray/assignAll0.adoc[`assignAll0`] | Set to 0 the value of every bit in this array. | xref:BloombergLP/bdlc/BitArray/assignAll1.adoc[`assignAll1`] | Set to 1 the value of every bit in this array. | xref:BloombergLP/bdlc/BitArray/assignBits.adoc[`assignBits`] | Assign low‐order bits from `srcBits` into this array at `index`. | xref:BloombergLP/bdlc/BitArray/bdexStreamIn.adoc[`bdexStreamIn`] | Assign to this object the value read from the specified input stream. | xref:BloombergLP/bdlc/BitArray/bdexStreamOut.adoc[`bdexStreamOut`] | Write this object to the specified output stream using `version`. | xref:BloombergLP/bdlc/BitArray/bits.adoc[`bits`] | Return `numBits` bits beginning at `index` as low‐order return bits. | xref:BloombergLP/bdlc/BitArray/find0AtMaxIndex.adoc[`find0AtMaxIndex`] | Return the highest index of a 0 bit in the optional range. | xref:BloombergLP/bdlc/BitArray/find0AtMinIndex.adoc[`find0AtMinIndex`] | Return the lowest index of a 0 bit in the optional range. | xref:BloombergLP/bdlc/BitArray/find1AtMaxIndex.adoc[`find1AtMaxIndex`] | Return the highest index of a 1 bit in the optional range. | xref:BloombergLP/bdlc/BitArray/find1AtMinIndex.adoc[`find1AtMinIndex`] | Return the lowest index of a 1 bit in the optional range. | xref:BloombergLP/bdlc/BitArray/insert-08.adoc[`insert`] | `insert` overloads | xref:BloombergLP/bdlc/BitArray/isAny0.adoc[`isAny0`] | Return `true` if the value of any bit in this array is 0, and `false` otherwise. | xref:BloombergLP/bdlc/BitArray/isAny1.adoc[`isAny1`] | Return `true` if the value of any bit in this array is 1, and `false` otherwise. | xref:BloombergLP/bdlc/BitArray/isEmpty.adoc[`isEmpty`] | Return `true` if the length of this bit array is 0, and `false` otherwise. | xref:BloombergLP/bdlc/BitArray/length.adoc[`length`] | Return the number of bits in this array. | xref:BloombergLP/bdlc/BitArray/minusEqual-0c.adoc[`minusEqual`] | `minusEqual` overloads | xref:BloombergLP/bdlc/BitArray/num0.adoc[`num0`] | Return the number of 0 bits in the optionally specified range. | xref:BloombergLP/bdlc/BitArray/num1.adoc[`num1`] | Return the number of 1 bits in the optionally specified range. | xref:BloombergLP/bdlc/BitArray/operator_and_eq.adoc[`operator&=`] | Bitwise AND `rhs` into this array and return a reference to this object. | xref:BloombergLP/bdlc/BitArray/operator_minus_eq.adoc[`operator‐=`] | Bitwise MINUS `rhs` from this array and return a reference to this object. | xref:BloombergLP/bdlc/BitArray/operator_lshift_eq.adoc[`operator<<=`] | Left‐shift this bit array by `numBits` positions. | xref:BloombergLP/bdlc/BitArray/operator_rshift_eq.adoc[`operator>>=`] | Right‐shift this bit array by `numBits` positions. | xref:BloombergLP/bdlc/BitArray/operator_subs.adoc[`operator[]`] | Return the value of the bit at the specified `index` in this array. The behavior is undefined unless `index < length()`. | xref:BloombergLP/bdlc/BitArray/operator_xor_eq.adoc[`operatorˆ=`] | Bitwise XOR `rhs` into this array and return a reference to this object. | xref:BloombergLP/bdlc/BitArray/operator_or_eq.adoc[`operator|=`] | Bitwise OR `rhs` into this array and return a reference to this object. | xref:BloombergLP/bdlc/BitArray/orEqual-076.adoc[`orEqual`] | `orEqual` overloads | xref:BloombergLP/bdlc/BitArray/print.adoc[`print`] | Format this object to the specified output stream. | xref:BloombergLP/bdlc/BitArray/remove-09.adoc[`remove`] | `remove` overloads | xref:BloombergLP/bdlc/BitArray/removeAll.adoc[`removeAll`] | Remove all of the bits in this array, leaving the length 0, but having no effect on capacity. | xref:BloombergLP/bdlc/BitArray/reserveCapacity.adoc[`reserveCapacity`] | Reserve capacity for at least `numBits` without reallocation. | xref:BloombergLP/bdlc/BitArray/rotateLeft.adoc[`rotateLeft`] | Rotate the bits in this array left by `numBits` positions. | xref:BloombergLP/bdlc/BitArray/rotateRight.adoc[`rotateRight`] | Rotate the bits in this array right by `numBits` positions. | xref:BloombergLP/bdlc/BitArray/setLength.adoc[`setLength`] | Set the number of bits in this array to `newLength`. | xref:BloombergLP/bdlc/BitArray/swap.adoc[`swap`] | Efficiently exchange the value of this object with that of `other`. | xref:BloombergLP/bdlc/BitArray/swapBits.adoc[`swapBits`] | Exchange the bit values at `index1` and `index2`. | xref:BloombergLP/bdlc/BitArray/toggle-0d1.adoc[`toggle`] | `toggle` overloads | xref:BloombergLP/bdlc/BitArray/toggleAll.adoc[`toggleAll`] | Complement the value of every bit in this array. Note that the behavior is analogous to applying the `~` operator to an object of fundamental type `unsigned int`. | xref:BloombergLP/bdlc/BitArray/xorEqual-0e.adoc[`xorEqual`] | `xorEqual` overloads |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/BitArray/maxSupportedBdexVersion-07.adoc[`maxSupportedBdexVersion`] | `maxSupportedBdexVersion` overloads |=== == Static Data Members [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/BitArray/k_INVALID_INDEX.adoc[`k_INVALID_INDEX`] | Sentinel index value indicating an invalid bit position. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/bdlc/operator_eq-04d.adoc[BloombergLP::bdlc::operator==]` | Return `true` if `lhs` and `rhs` have the same value, else `false`. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/operator_not_eq-008.adoc[`operator!=`] | Return `true` if `lhs` and `rhs` do not have the same value, else `false`. | xref:BloombergLP/bdlc/operator_bitand.adoc[`operator&`] | Return the bitwise AND of the specified `lhs` and `rhs` arrays. | xref:BloombergLP/bdlc/operator_minus-0a9.adoc[`operator‐`] | Return the bitwise MINUS of the specified `lhs` and `rhs` arrays. | xref:BloombergLP/bdlc/operator_lshift-0688.adoc[`operator<<`] | Return `array` left‐shifted by `numBits`, filling low bits with zeros. | xref:BloombergLP/bdlc/operator_rshift.adoc[`operator>>`] | Return `array` right‐shifted by `numBits`, filling high bits with zeros. | xref:BloombergLP/bdlc/operator_xor.adoc[`operatorˆ`] | Return the bitwise XOR of the specified `lhs` and `rhs` arrays. | xref:BloombergLP/bdlc/operator_bitor.adoc[`operator|`] | Return the bitwise OR of the specified `lhs` and `rhs` arrays. | xref:BloombergLP/bdlc/operator_bitnot.adoc[`operator~`] | Return the bitwise complement ("toggle") of the specified `array`. | xref:BloombergLP/bdlc/swap-00b.adoc[`swap`] | Exchange the values of the specified `a` and `b` objects. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#