This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

643
cppdraft/template/bitset.md Normal file
View File

@@ -0,0 +1,643 @@
[template.bitset]
# 22 General utilities library [[utilities]](./#utilities)
## 22.9 Bitsets [[bitset]](bitset#template.bitset)
### 22.9.2 Class template bitset [template.bitset]
#### [22.9.2.1](#general) General [[template.bitset.general]](template.bitset.general)
[🔗](#lib:bitset)
namespace std {template<size_t N> class bitset {public:// bit referenceclass reference {public:constexpr reference(const reference&) = default; constexpr ~reference(); constexpr reference& operator=(bool x) noexcept; // for b[i] = x;constexpr reference& operator=(const reference&) noexcept; // for b[i] = b[j];constexpr bool operator~() const noexcept; // flips the bitconstexpr operator bool() const noexcept; // for x = b[i];constexpr reference& flip() noexcept; // for b[i].flip();}; // [[bitset.cons]](#bitset.cons "22.9.2.2Constructors"), constructorsconstexpr bitset() noexcept; constexpr bitset(unsigned long long val) noexcept; template<class charT, class traits, class Allocator>constexpr explicit bitset(const basic_string<charT, traits, Allocator>& str, typename basic_string<charT, traits, Allocator>::size_type pos = 0, typename basic_string<charT, traits, Allocator>::size_type n = basic_string<charT, traits, Allocator>::npos,
charT zero = charT('0'),
charT one = charT('1')); template<class charT, class traits>constexpr explicit bitset( basic_string_view<charT, traits> str, typename basic_string_view<charT, traits>::size_type pos = 0, typename basic_string_view<charT, traits>::size_type n = basic_string_view<charT, traits>::npos,
charT zero = charT('0'),
charT one = charT('1')); template<class charT>constexpr explicit bitset(const charT* str, typename basic_string_view<charT>::size_type n = basic_string_view<charT>::npos,
charT zero = charT('0'),
charT one = charT('1')); // [[bitset.members]](#bitset.members "22.9.2.3Members"), bitset operationsconstexpr bitset& operator&=(const bitset& rhs) noexcept; constexpr bitset& operator|=(const bitset& rhs) noexcept; constexpr bitset& operator^=(const bitset& rhs) noexcept; constexpr bitset& operator<<=(size_t pos) noexcept; constexpr bitset& operator>>=(size_t pos) noexcept; constexpr bitset operator<<(size_t pos) const noexcept; constexpr bitset operator>>(size_t pos) const noexcept; constexpr bitset& set() noexcept; constexpr bitset& set(size_t pos, bool val = true); constexpr bitset& reset() noexcept; constexpr bitset& reset(size_t pos); constexpr bitset operator~() const noexcept; constexpr bitset& flip() noexcept; constexpr bitset& flip(size_t pos); // element accessconstexpr bool operator[](size_t pos) const; constexpr reference operator[](size_t pos); constexpr unsigned long to_ulong() const; constexpr unsigned long long to_ullong() const; template<class charT = char, class traits = char_traits<charT>, class Allocator = allocator<charT>>constexpr basic_string<charT, traits, Allocator> to_string(charT zero = charT('0'), charT one = charT('1')) const; // observersconstexpr size_t count() const noexcept; constexpr size_t size() const noexcept; constexpr bool operator==(const bitset& rhs) const noexcept; constexpr bool test(size_t pos) const; constexpr bool all() const noexcept; constexpr bool any() const noexcept; constexpr bool none() const noexcept; }; // [[bitset.hash]](bitset.hash "22.9.3bitset hash support"), hash supporttemplate<class T> struct hash; template<size_t N> struct hash<bitset<N>>;}
[1](#general-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10478)
The class templatebitset<N> describes an object that can store a sequence consisting of a fixed number of
bits, N[.](#general-1.sentence-1)
[2](#general-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10484)
Each bit represents either the value zero (reset) or one (set)[.](#general-2.sentence-1)
To[*toggle*](#def:toggle) a bit is to change the value zero to one, or the value one to
zero[.](#general-2.sentence-2)
Each bit has a non-negative position pos[.](#general-2.sentence-3)
When converting
between an object of classbitset<N> and a value of some
integral type, bit position pos corresponds to the[*bit value*](#def:bit_value)1 << pos[.](#general-2.sentence-4)
The integral value corresponding to two
or more bits is the sum of their bit values[.](#general-2.sentence-5)
[3](#general-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10501)
The functions described in [template.bitset] can report three kinds of
errors, each associated with a distinct exception:
- [(3.1)](#general-3.1)
an[*invalid-argument*](#def:invalid-argument) error is associated with exceptions of typeinvalid_argument ([[invalid.argument]](invalid.argument "19.2.5Class invalid_­argument"));
- [(3.2)](#general-3.2)
an[*out-of-range*](#def:out-of-range) error is associated with exceptions of typeout_of_range ([[out.of.range]](out.of.range "19.2.7Class out_­of_­range"));
- [(3.3)](#general-3.3)
an[*overflow*](#def:overflow) error is associated with exceptions of typeoverflow_error ([[overflow.error]](overflow.error "19.2.10Class overflow_­error"))[.](#general-3.sentence-1)
#### [22.9.2.2](#bitset.cons) Constructors [[bitset.cons]](bitset.cons)
[🔗](#lib:bitset,constructor)
`constexpr bitset() noexcept;
`
[1](#bitset.cons-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10533)
*Effects*: Initializes all bits in *this to zero[.](#bitset.cons-1.sentence-1)
[🔗](#lib:bitset,constructor_)
`constexpr bitset(unsigned long long val) noexcept;
`
[2](#bitset.cons-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10544)
*Effects*: Initializes the first M bit positions to the corresponding bit
values in val[.](#bitset.cons-2.sentence-1)
M is the smaller of N and the number of bits in the value
representation ([[basic.types.general]](basic.types.general#term.object.representation "6.9.1General")) of unsigned long long[.](#bitset.cons-2.sentence-2)
If M < N, the remaining bit positions are initialized to zero[.](#bitset.cons-2.sentence-3)
[🔗](#lib:bitset,constructor__)
`template<class charT, class traits, class Allocator>
constexpr explicit bitset(
const basic_string<charT, traits, Allocator>& str,
typename basic_string<charT, traits, Allocator>::size_type pos = 0,
typename basic_string<charT, traits, Allocator>::size_type n
= basic_string<charT, traits, Allocator>::npos,
charT zero = charT('0'),
charT one = charT('1'));
template<class charT, class traits>
constexpr explicit bitset(
basic_string_view<charT, traits> str,
typename basic_string_view<charT, traits>::size_type pos = 0,
typename basic_string_view<charT, traits>::size_type n
= basic_string_view<charT, traits>::npos,
charT zero = charT('0'),
charT one = charT('1'));
`
[3](#bitset.cons-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10574)
*Effects*: Determines the effective lengthrlen of the initializing string as the smaller ofn andstr.size() - pos[.](#bitset.cons-3.sentence-1)
Initializes the first M bit
positions to values determined from the corresponding characters in the stringstr[.](#bitset.cons-3.sentence-2)
M is the smaller of N and rlen[.](#bitset.cons-3.sentence-3)
[4](#bitset.cons-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10585)
An element of the constructed object has value zero if the
corresponding character in str, beginning at positionpos, iszero[.](#bitset.cons-4.sentence-1)
Otherwise, the element has the value one[.](#bitset.cons-4.sentence-2)
Character position pos + M - 1 corresponds to bit position zero[.](#bitset.cons-4.sentence-3)
Subsequent decreasing character positions correspond to increasing bit positions[.](#bitset.cons-4.sentence-4)
[5](#bitset.cons-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10594)
If M < N, remaining bit positions are initialized to zero[.](#bitset.cons-5.sentence-1)
[6](#bitset.cons-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10597)
The function uses traits::eq to compare the character values[.](#bitset.cons-6.sentence-1)
[7](#bitset.cons-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10601)
*Throws*: out_of_range if pos > str.size() orinvalid_argument if any of
the rlen characters in str beginning at position pos is other than zero or one[.](#bitset.cons-7.sentence-1)
[🔗](#lib:bitset,constructor___)
`template<class charT>
constexpr explicit bitset(
const charT* str,
typename basic_string_view<charT>::size_type n = basic_string_view<charT>::npos,
charT zero = charT('0'),
charT one = charT('1'));
`
[8](#bitset.cons-8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10623)
*Effects*: As if by:bitset(n == basic_string_view<charT>::npos ? basic_string_view<charT>(str): basic_string_view<charT>(str, n), 0, n, zero, one)
#### [22.9.2.3](#bitset.members) Members [[bitset.members]](bitset.members)
[🔗](#lib:operator&=,bitset)
`constexpr bitset& operator&=(const bitset& rhs) noexcept;
`
[1](#bitset.members-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10643)
*Effects*: Clears each bit in*this for which the corresponding bit in rhs is clear, and leaves all other bits unchanged[.](#bitset.members-1.sentence-1)
[2](#bitset.members-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10649)
*Returns*: *this[.](#bitset.members-2.sentence-1)
[🔗](#lib:operator%7c=,bitset)
`constexpr bitset& operator|=(const bitset& rhs) noexcept;
`
[3](#bitset.members-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10660)
*Effects*: Sets each bit in*this for which the corresponding bit in rhs is set, and leaves all other bits unchanged[.](#bitset.members-3.sentence-1)
[4](#bitset.members-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10666)
*Returns*: *this[.](#bitset.members-4.sentence-1)
[🔗](#lib:operator%5e=,bitset)
`constexpr bitset& operator^=(const bitset& rhs) noexcept;
`
[5](#bitset.members-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10677)
*Effects*: Toggles each bit in*this for which the corresponding bit in rhs is set, and leaves all other bits unchanged[.](#bitset.members-5.sentence-1)
[6](#bitset.members-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10683)
*Returns*: *this[.](#bitset.members-6.sentence-1)
[🔗](#lib:operator%3c%3c=,bitset)
`constexpr bitset& operator<<=(size_t pos) noexcept;
`
[7](#bitset.members-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10694)
*Effects*: Replaces each bit at position I in*this with a value determined as follows:
- [(7.1)](#bitset.members-7.1)
If I < pos, the new value is zero;
- [(7.2)](#bitset.members-7.2)
If I >= pos, the new value is the previous
value of the bit at position I - pos[.](#bitset.members-7.sentence-1)
[8](#bitset.members-8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10707)
*Returns*: *this[.](#bitset.members-8.sentence-1)
[🔗](#lib:operator%3e%3e=,bitset)
`constexpr bitset& operator>>=(size_t pos) noexcept;
`
[9](#bitset.members-9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10718)
*Effects*: Replaces each bit at position I in*this with a value determined as follows:
- [(9.1)](#bitset.members-9.1)
If pos >= N - I, the new value is zero;
- [(9.2)](#bitset.members-9.2)
If pos < N - I, the new value is the previous value of the bit at position I + pos[.](#bitset.members-9.sentence-1)
[10](#bitset.members-10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10730)
*Returns*: *this[.](#bitset.members-10.sentence-1)
[🔗](#lib:operator%3c%3c,bitset)
`constexpr bitset operator<<(size_t pos) const noexcept;
`
[11](#bitset.members-11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10741)
*Returns*: bitset(*this) <<= pos[.](#bitset.members-11.sentence-1)
[🔗](#lib:operator%3e%3e,bitset)
`constexpr bitset operator>>(size_t pos) const noexcept;
`
[12](#bitset.members-12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10752)
*Returns*: bitset(*this) >>= pos[.](#bitset.members-12.sentence-1)
[🔗](#lib:set_(member),bitset)
`constexpr bitset& set() noexcept;
`
[13](#bitset.members-13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10765)
*Effects*: Sets all bits in*this[.](#bitset.members-13.sentence-1)
[14](#bitset.members-14)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10770)
*Returns*: *this[.](#bitset.members-14.sentence-1)
[🔗](#lib:set_(member),bitset_)
`constexpr bitset& set(size_t pos, bool val = true);
`
[15](#bitset.members-15)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10783)
*Effects*: Stores a new value in the bit at position pos in*this[.](#bitset.members-15.sentence-1)
If val is true, the stored value is one, otherwise it is zero[.](#bitset.members-15.sentence-2)
[16](#bitset.members-16)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10789)
*Returns*: *this[.](#bitset.members-16.sentence-1)
[17](#bitset.members-17)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10793)
*Throws*: out_of_range if pos does not correspond to a valid bit position[.](#bitset.members-17.sentence-1)
[🔗](#lib:reset,bitset)
`constexpr bitset& reset() noexcept;
`
[18](#bitset.members-18)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10805)
*Effects*: Resets all bits in*this[.](#bitset.members-18.sentence-1)
[19](#bitset.members-19)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10810)
*Returns*: *this[.](#bitset.members-19.sentence-1)
[🔗](#lib:reset,bitset_)
`constexpr bitset& reset(size_t pos);
`
[20](#bitset.members-20)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10821)
*Effects*: Resets the bit at position pos in*this[.](#bitset.members-20.sentence-1)
[21](#bitset.members-21)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10826)
*Returns*: *this[.](#bitset.members-21.sentence-1)
[22](#bitset.members-22)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10830)
*Throws*: out_of_range if pos does not correspond to a valid bit position[.](#bitset.members-22.sentence-1)
[🔗](#lib:operator~,bitset)
`constexpr bitset operator~() const noexcept;
`
[23](#bitset.members-23)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10842)
*Effects*: Constructs an object x of classbitset and initializes it with*this[.](#bitset.members-23.sentence-1)
[24](#bitset.members-24)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10849)
*Returns*: x.flip()[.](#bitset.members-24.sentence-1)
[🔗](#lib:flip,bitset)
`constexpr bitset& flip() noexcept;
`
[25](#bitset.members-25)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10860)
*Effects*: Toggles all bits in*this[.](#bitset.members-25.sentence-1)
[26](#bitset.members-26)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10865)
*Returns*: *this[.](#bitset.members-26.sentence-1)
[🔗](#lib:flip,bitset_)
`constexpr bitset& flip(size_t pos);
`
[27](#bitset.members-27)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10876)
*Effects*: Toggles the bit at position pos in*this[.](#bitset.members-27.sentence-1)
[28](#bitset.members-28)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10881)
*Returns*: *this[.](#bitset.members-28.sentence-1)
[29](#bitset.members-29)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10885)
*Throws*: out_of_range if pos does not correspond to a valid bit position[.](#bitset.members-29.sentence-1)
[🔗](#lib:operator%5b%5d,bitset)
`constexpr bool operator[](size_t pos) const;
`
[30](#bitset.members-30)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10897)
*Hardened preconditions*: pos < size() is true[.](#bitset.members-30.sentence-1)
[31](#bitset.members-31)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10901)
*Returns*: true if the bit at position pos in *this has the value
one, otherwise false[.](#bitset.members-31.sentence-1)
[32](#bitset.members-32)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10906)
*Throws*: Nothing[.](#bitset.members-32.sentence-1)
[🔗](#lib:operator%5b%5d,bitset_)
`constexpr bitset::reference operator[](size_t pos);
`
[33](#bitset.members-33)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10917)
*Hardened preconditions*: pos < size() is true[.](#bitset.members-33.sentence-1)
[34](#bitset.members-34)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10921)
*Returns*: An object of typebitset::reference such that(*this)[pos] == this->test(pos),
and such that(*this)[pos] = val is equivalent tothis->set(pos, val)[.](#bitset.members-34.sentence-1)
[35](#bitset.members-35)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10932)
*Throws*: Nothing[.](#bitset.members-35.sentence-1)
[36](#bitset.members-36)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10936)
*Remarks*: For the purpose of determining the presence of a data
race ([[intro.multithread]](intro.multithread "6.10.2Multi-threaded executions and data races")), any access or update through the resulting
reference potentially accesses or modifies, respectively, the entire
underlying bitset[.](#bitset.members-36.sentence-1)
[🔗](#lib:to_ulong,bitset)
`constexpr unsigned long to_ulong() const;
`
[37](#bitset.members-37)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10950)
*Returns*: x[.](#bitset.members-37.sentence-1)
[38](#bitset.members-38)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10954)
*Throws*: overflow_error if the integral value x corresponding to the bits in *this cannot be represented as type unsigned long[.](#bitset.members-38.sentence-1)
[🔗](#lib:to_ullong,bitset)
`constexpr unsigned long long to_ullong() const;
`
[39](#bitset.members-39)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10968)
*Returns*: x[.](#bitset.members-39.sentence-1)
[40](#bitset.members-40)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10972)
*Throws*: overflow_error if the integral value x corresponding to the bits in *this cannot be represented as type unsigned long long[.](#bitset.members-40.sentence-1)
[🔗](#lib:to_string,bitset)
`template<class charT = char,
class traits = char_traits<charT>,
class Allocator = allocator<charT>>
constexpr basic_string<charT, traits, Allocator>
to_string(charT zero = charT('0'), charT one = charT('1')) const;
`
[41](#bitset.members-41)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10990)
*Effects*: Constructs a string object of the appropriate type
and initializes it to a string of length N characters[.](#bitset.members-41.sentence-1)
Each character is determined by the value of its corresponding bit position in*this[.](#bitset.members-41.sentence-2)
Character position N - 1 corresponds to bit position zero[.](#bitset.members-41.sentence-3)
Subsequent decreasing character positions correspond to increasing bit
positions[.](#bitset.members-41.sentence-4)
Bit value zero becomes the character zero,
bit value one becomes the characterone[.](#bitset.members-41.sentence-5)
[42](#bitset.members-42)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11003)
*Returns*: The created object[.](#bitset.members-42.sentence-1)
[🔗](#lib:count,bitset)
`constexpr size_t count() const noexcept;
`
[43](#bitset.members-43)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11014)
*Returns*: A count of the number of bits set in*this[.](#bitset.members-43.sentence-1)
[🔗](#lib:size,bitset)
`constexpr size_t size() const noexcept;
`
[44](#bitset.members-44)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11026)
*Returns*: N[.](#bitset.members-44.sentence-1)
[🔗](#lib:operator==,bitset)
`constexpr bool operator==(const bitset& rhs) const noexcept;
`
[45](#bitset.members-45)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11037)
*Returns*: true if the value of each bit in*this equals the value of the corresponding bit in rhs[.](#bitset.members-45.sentence-1)
[🔗](#lib:test,bitset)
`constexpr bool test(size_t pos) const;
`
[46](#bitset.members-46)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11050)
*Returns*: true if the bit at position pos in*this has the value one[.](#bitset.members-46.sentence-1)
[47](#bitset.members-47)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11058)
*Throws*: out_of_range if pos does not correspond to a valid bit position[.](#bitset.members-47.sentence-1)
[🔗](#lib:all,bitset)
`constexpr bool all() const noexcept;
`
[48](#bitset.members-48)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11070)
*Returns*: count() == size()[.](#bitset.members-48.sentence-1)
[🔗](#lib:any_(member),bitset)
`constexpr bool any() const noexcept;
`
[49](#bitset.members-49)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11083)
*Returns*: count() != 0[.](#bitset.members-49.sentence-1)
[🔗](#lib:none,bitset)
`constexpr bool none() const noexcept;
`
[50](#bitset.members-50)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11094)
*Returns*: count() == 0[.](#bitset.members-50.sentence-1)