[#BloombergLP-bdlc-BitArray-setLength] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlc.adoc[bdlc]::xref:BloombergLP/bdlc/BitArray.adoc[BitArray]::setLength :relfileprefix: ../../../ :mrdocs: Set the number of bits in this array to `newLength`. == Synopsis Declared in `<bdlc_bitarray.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void setLength( std::size_t newLength, bool value = false); ---- == Description Set the number of bits in this array to the specified `newLength`. If `newLength < length()`, bits at index positions at or above `newLength` are removed; otherwise, any new bits (at or above the current length) are initialized to the optionally specified `value`, or to 0 if `value` is not specified. == Parameters [cols="1,4"] |=== | Name| Description | *newLength* | new length of this array, in bits | *value* | initial value for any newly added bits |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#