[#bsl-bitset]
= xref:bsl.adoc[bsl]::bitset
:relfileprefix: ../
:mrdocs:

STL&hyphen;compliant fixed&hyphen;size sequence of `N` bits&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;bitset&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;std::size&lowbar;t N&gt;
class bitset;
----

== Description

This class template provides an STL&hyphen;compliant `bitset`&period; For the requirements of a `bitset` class, consult the second revision of the ISO&sol;IEC 14882 Programming Language c&plus;&plus; (2011)&period;

In addition to the methods defined in the standard, this class also provides an extra constructor that takes a `bsl&colon;&colon;basic&lowbar;string`&period; This extra constructor provides the capability to construct a `bitset` from a `bsl&colon;&colon;basic&lowbar;string`, in addition to a `std&colon;&colon;basic&lowbar;string`&period;

== Types

[cols="1,4"]
|===
| Name| Description
| xref:bsl/bitset/reference.adoc[`reference`] 
| This class represents a reference to a modifiable bit inside a `bsl&colon;&colon;bitset`&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:bsl/bitset/2constructor-07.adoc[`bitset`]         [.small]#[constructor]#
| Constructors
| xref:bsl/bitset/all.adoc[`all`] 
| Return `true` if all of the bits in this bitset have the value of 1 and `false` otherwise&period; Note that `all()` and `none()` are both true for bitsets of size 0&period;
| xref:bsl/bitset/any.adoc[`any`] 
| Return `true` if one or more of the bits in this bitset has the value of 1 and `false` otherwise&period;
| xref:bsl/bitset/count.adoc[`count`] 
| Return the number of bits in this bitset that have the value of 1&period;
| xref:bsl/bitset/flip-0b.adoc[`flip`] 
| `flip` overloads
| xref:bsl/bitset/none.adoc[`none`] 
| Return `true` if all the bits in this bitset has the value of 0 and `false` otherwise&period; Note that `all()` and `none()` are both true for bitsets of size 0&period;
| xref:bsl/bitset/operator_and_eq.adoc[`operator&amp;&equals;`] 
| Clear bits of this bitset where the corresponding bits of `rhs` are 0&period;
| xref:bsl/bitset/operator_lshift_eq.adoc[`operator&lt;&lt;&equals;`] 
| Shift the bits of this bitset left by the specified `pos`&period;
| xref:bsl/bitset/operator_rshift.adoc[`operator&gt;&gt;`] 
| Return a bitset constructed from shifting this bitset right by the specified `pos`&period;
| xref:bsl/bitset/operator_rshift_eq.adoc[`operator&gt;&gt;&equals;`] 
| Shift the bits of this bitset right by the specified `pos`&period;
| xref:bsl/bitset/operator_subs-03.adoc[`operator&lsqb;&rsqb;`] 
| Subscript operators
| xref:bsl/bitset/operator_xor_eq.adoc[`operator&circ;&equals;`] 
| Toggle bits of this bitset where the corresponding bits of `rhs` are 1&period;
| xref:bsl/bitset/operator_or_eq.adoc[`operator&verbar;&equals;`] 
| Set bits of this bitset where the corresponding bits of `rhs` are 1&period;
| xref:bsl/bitset/operator_bitnot.adoc[`operator&#126;`] 
| Toggle all bits of this bitset and return a reference to this modifiable bitset&period;
| xref:bsl/bitset/reset-038.adoc[`reset`] 
| `reset` overloads
| xref:bsl/bitset/set-0c.adoc[`set`] 
| `set` overloads
| xref:bsl/bitset/size.adoc[`size`] 
| Return the number of bits this bitset holds&period;
| xref:bsl/bitset/test.adoc[`test`] 
| Return `true` if the bit at the specified `pos` has the value of 1 and `false` otherwise&period;
| xref:bsl/bitset/to_string.adoc[`to&lowbar;string`] 
| Return a string representation of this bitset using `zero` and `one`&period;
| xref:bsl/bitset/to_ulong.adoc[`to&lowbar;ulong`] 
| Return an `unsigned long` with the same bit pattern as this bitset&period;
| xref:bsl/bitset/operator_lshift.adoc[`operator&lt;&lt;`] 
| Return a bitset constructed from shifting this bitset left by the specified `pos`&period;
| xref:bsl/bitset/operator_eq.adoc[`operator&equals;&equals;`] 
| Return `true` if `rhs` has the same bit values as this bitset&period;
| xref:bsl/bitset/operator_not_eq.adoc[`operator!&equals;`] 
| Return `true` if `rhs` does not have the same bit values as this bitset&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:bsl/reference.adoc[bsl::reference]`
| Proxy providing a mutable reference to a single bit in a `bitset`&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:bsl/operator_bitand.adoc[`operator&amp;`]
| Return a `bitset` that results from a bitwise AND of the specified `lhs` and `rhs`&period;
| xref:bsl/operator_xor.adoc[`operator&circ;`]
| Return a `bitset` that results from a bitwise XOR of the specified `lhs` and `rhs`&period;
| xref:bsl/operator_bitor.adoc[`operator&verbar;`]
| Return a `bitset` that results from a bitwise OR of the specified `lhs` and `rhs`&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
