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

116
cppdraft/bitset/cons.md Normal file
View File

@@ -0,0 +1,116 @@
[bitset.cons]
# 22 General utilities library [[utilities]](./#utilities)
## 22.9 Bitsets [[bitset]](bitset#cons)
### 22.9.2 Class template bitset [[template.bitset]](template.bitset#bitset.cons)
#### 22.9.2.2 Constructors [bitset.cons]
[🔗](#lib:bitset,constructor)
`constexpr bitset() noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10533)
*Effects*: Initializes all bits in *this to zero[.](#1.sentence-1)
[🔗](#lib:bitset,constructor_)
`constexpr bitset(unsigned long long val) noexcept;
`
[2](#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[.](#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[.](#2.sentence-2)
If M < N, the remaining bit positions are initialized to zero[.](#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](#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[.](#3.sentence-1)
Initializes the first M bit
positions to values determined from the corresponding characters in the stringstr[.](#3.sentence-2)
M is the smaller of N and rlen[.](#3.sentence-3)
[4](#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[.](#4.sentence-1)
Otherwise, the element has the value one[.](#4.sentence-2)
Character position pos + M - 1 corresponds to bit position zero[.](#4.sentence-3)
Subsequent decreasing character positions correspond to increasing bit positions[.](#4.sentence-4)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10594)
If M < N, remaining bit positions are initialized to zero[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10597)
The function uses traits::eq to compare the character values[.](#6.sentence-1)
[7](#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[.](#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](#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)

18
cppdraft/bitset/hash.md Normal file
View File

@@ -0,0 +1,18 @@
[bitset.hash]
# 22 General utilities library [[utilities]](./#utilities)
## 22.9 Bitsets [[bitset]](bitset#hash)
### 22.9.3 bitset hash support [bitset.hash]
[🔗](#lib:hash_code)
`template<size_t N> struct hash<bitset<N>>;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11107)
The specialization is enabled ([[unord.hash]](unord.hash "22.10.19Class template hash"))[.](#1.sentence-1)

478
cppdraft/bitset/members.md Normal file
View File

@@ -0,0 +1,478 @@
[bitset.members]
# 22 General utilities library [[utilities]](./#utilities)
## 22.9 Bitsets [[bitset]](bitset#members)
### 22.9.2 Class template bitset [[template.bitset]](template.bitset#bitset.members)
#### 22.9.2.3 Members [bitset.members]
[🔗](#lib:operator&=,bitset)
`constexpr bitset& operator&=(const bitset& rhs) noexcept;
`
[1](#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[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10649)
*Returns*: *this[.](#2.sentence-1)
[🔗](#lib:operator%7c=,bitset)
`constexpr bitset& operator|=(const bitset& rhs) noexcept;
`
[3](#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[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10666)
*Returns*: *this[.](#4.sentence-1)
[🔗](#lib:operator%5e=,bitset)
`constexpr bitset& operator^=(const bitset& rhs) noexcept;
`
[5](#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[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10683)
*Returns*: *this[.](#6.sentence-1)
[🔗](#lib:operator%3c%3c=,bitset)
`constexpr bitset& operator<<=(size_t pos) noexcept;
`
[7](#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)](#7.1)
If I < pos, the new value is zero;
- [(7.2)](#7.2)
If I >= pos, the new value is the previous
value of the bit at position I - pos[.](#7.sentence-1)
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10707)
*Returns*: *this[.](#8.sentence-1)
[🔗](#lib:operator%3e%3e=,bitset)
`constexpr bitset& operator>>=(size_t pos) noexcept;
`
[9](#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)](#9.1)
If pos >= N - I, the new value is zero;
- [(9.2)](#9.2)
If pos < N - I, the new value is the previous value of the bit at position I + pos[.](#9.sentence-1)
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10730)
*Returns*: *this[.](#10.sentence-1)
[🔗](#lib:operator%3c%3c,bitset)
`constexpr bitset operator<<(size_t pos) const noexcept;
`
[11](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10741)
*Returns*: bitset(*this) <<= pos[.](#11.sentence-1)
[🔗](#lib:operator%3e%3e,bitset)
`constexpr bitset operator>>(size_t pos) const noexcept;
`
[12](#12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10752)
*Returns*: bitset(*this) >>= pos[.](#12.sentence-1)
[🔗](#lib:set_(member),bitset)
`constexpr bitset& set() noexcept;
`
[13](#13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10765)
*Effects*: Sets all bits in*this[.](#13.sentence-1)
[14](#14)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10770)
*Returns*: *this[.](#14.sentence-1)
[🔗](#lib:set_(member),bitset_)
`constexpr bitset& set(size_t pos, bool val = true);
`
[15](#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[.](#15.sentence-1)
If val is true, the stored value is one, otherwise it is zero[.](#15.sentence-2)
[16](#16)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10789)
*Returns*: *this[.](#16.sentence-1)
[17](#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[.](#17.sentence-1)
[🔗](#lib:reset,bitset)
`constexpr bitset& reset() noexcept;
`
[18](#18)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10805)
*Effects*: Resets all bits in*this[.](#18.sentence-1)
[19](#19)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10810)
*Returns*: *this[.](#19.sentence-1)
[🔗](#lib:reset,bitset_)
`constexpr bitset& reset(size_t pos);
`
[20](#20)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10821)
*Effects*: Resets the bit at position pos in*this[.](#20.sentence-1)
[21](#21)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10826)
*Returns*: *this[.](#21.sentence-1)
[22](#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[.](#22.sentence-1)
[🔗](#lib:operator~,bitset)
`constexpr bitset operator~() const noexcept;
`
[23](#23)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10842)
*Effects*: Constructs an object x of classbitset and initializes it with*this[.](#23.sentence-1)
[24](#24)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10849)
*Returns*: x.flip()[.](#24.sentence-1)
[🔗](#lib:flip,bitset)
`constexpr bitset& flip() noexcept;
`
[25](#25)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10860)
*Effects*: Toggles all bits in*this[.](#25.sentence-1)
[26](#26)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10865)
*Returns*: *this[.](#26.sentence-1)
[🔗](#lib:flip,bitset_)
`constexpr bitset& flip(size_t pos);
`
[27](#27)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10876)
*Effects*: Toggles the bit at position pos in*this[.](#27.sentence-1)
[28](#28)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10881)
*Returns*: *this[.](#28.sentence-1)
[29](#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[.](#29.sentence-1)
[🔗](#lib:operator%5b%5d,bitset)
`constexpr bool operator[](size_t pos) const;
`
[30](#30)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10897)
*Hardened preconditions*: pos < size() is true[.](#30.sentence-1)
[31](#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[.](#31.sentence-1)
[32](#32)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10906)
*Throws*: Nothing[.](#32.sentence-1)
[🔗](#lib:operator%5b%5d,bitset_)
`constexpr bitset::reference operator[](size_t pos);
`
[33](#33)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10917)
*Hardened preconditions*: pos < size() is true[.](#33.sentence-1)
[34](#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)[.](#34.sentence-1)
[35](#35)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10932)
*Throws*: Nothing[.](#35.sentence-1)
[36](#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[.](#36.sentence-1)
[🔗](#lib:to_ulong,bitset)
`constexpr unsigned long to_ulong() const;
`
[37](#37)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10950)
*Returns*: x[.](#37.sentence-1)
[38](#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[.](#38.sentence-1)
[🔗](#lib:to_ullong,bitset)
`constexpr unsigned long long to_ullong() const;
`
[39](#39)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10968)
*Returns*: x[.](#39.sentence-1)
[40](#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[.](#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](#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[.](#41.sentence-1)
Each character is determined by the value of its corresponding bit position in*this[.](#41.sentence-2)
Character position N - 1 corresponds to bit position zero[.](#41.sentence-3)
Subsequent decreasing character positions correspond to increasing bit
positions[.](#41.sentence-4)
Bit value zero becomes the character zero,
bit value one becomes the characterone[.](#41.sentence-5)
[42](#42)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11003)
*Returns*: The created object[.](#42.sentence-1)
[🔗](#lib:count,bitset)
`constexpr size_t count() const noexcept;
`
[43](#43)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11014)
*Returns*: A count of the number of bits set in*this[.](#43.sentence-1)
[🔗](#lib:size,bitset)
`constexpr size_t size() const noexcept;
`
[44](#44)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11026)
*Returns*: N[.](#44.sentence-1)
[🔗](#lib:operator==,bitset)
`constexpr bool operator==(const bitset& rhs) const noexcept;
`
[45](#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[.](#45.sentence-1)
[🔗](#lib:test,bitset)
`constexpr bool test(size_t pos) const;
`
[46](#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[.](#46.sentence-1)
[47](#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[.](#47.sentence-1)
[🔗](#lib:all,bitset)
`constexpr bool all() const noexcept;
`
[48](#48)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11070)
*Returns*: count() == size()[.](#48.sentence-1)
[🔗](#lib:any_(member),bitset)
`constexpr bool any() const noexcept;
`
[49](#49)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11083)
*Returns*: count() != 0[.](#49.sentence-1)
[🔗](#lib:none,bitset)
`constexpr bool none() const noexcept;
`
[50](#50)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11094)
*Returns*: count() == 0[.](#50.sentence-1)

View File

@@ -0,0 +1,106 @@
[bitset.operators]
# 22 General utilities library [[utilities]](./#utilities)
## 22.9 Bitsets [[bitset]](bitset#operators)
### 22.9.4 bitset operators [bitset.operators]
[🔗](#lib:operator&,bitset)
`template<size_t N>
constexpr bitset<N> operator&(const bitset<N>& lhs, const bitset<N>& rhs) noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11121)
*Returns*: bitset<N>(lhs) &= rhs[.](#1.sentence-1)
[🔗](#lib:operator%7c,bitset)
`template<size_t N>
constexpr bitset<N> operator|(const bitset<N>& lhs, const bitset<N>& rhs) noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11133)
*Returns*: bitset<N>(lhs) |= rhs[.](#2.sentence-1)
[🔗](#lib:operator%5e,bitset)
`template<size_t N>
constexpr bitset<N> operator^(const bitset<N>& lhs, const bitset<N>& rhs) noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11145)
*Returns*: bitset<N>(lhs) ^= rhs[.](#3.sentence-1)
[🔗](#lib:operator%3e%3e,bitset)
`template<class charT, class traits, size_t N>
basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, bitset<N>& x);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11158)
A formatted input function ([[istream.formatted]](istream.formatted "31.7.5.3Formatted input functions"))[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11161)
*Effects*: Extracts up to N characters from is[.](#5.sentence-1)
Stores these characters in a temporary object str of typebasic_string<charT, traits>,
then evaluates the expressionx = bitset<N>(str)[.](#5.sentence-2)
Characters are extracted and stored until any of the following occurs:
- [(5.1)](#5.1)
N characters have been extracted and stored;
- [(5.2)](#5.2)
end-of-file occurs on the input sequence;
- [(5.3)](#5.3)
the next input character is neitheris.widen('0') noris.widen('1') (in which case the input character is not extracted)[.](#5.sentence-3)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11183)
If N > 0 and no characters are stored in str,ios_base::failbit is set in the input function's local error state
before setstate is called[.](#6.sentence-1)
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11188)
*Returns*: is[.](#7.sentence-1)
[🔗](#lib:operator%3c%3c,bitset)
`template<class charT, class traits, size_t N>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const bitset<N>& x);
`
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11201)
*Returns*: os << x.template to_string<charT, traits, allocator<charT>>( use_facet<ctype<charT>>(os.getloc()).widen('0'),
use_facet<ctype<charT>>(os.getloc()).widen('1')) (see [[ostream.formatted]](ostream.formatted "31.7.6.3Formatted output functions"))[.](#8.sentence-1)

17
cppdraft/bitset/syn.md Normal file
View File

@@ -0,0 +1,17 @@
[bitset.syn]
# 22 General utilities library [[utilities]](./#utilities)
## 22.9 Bitsets [[bitset]](bitset#syn)
### 22.9.1 Header <bitset> synopsis [bitset.syn]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10360)
The header <bitset> defines a class template
and several related functions for representing
and manipulating fixed-size sequences of bits[.](#1.sentence-1)
#include <string> // see [[string.syn]](string.syn "27.4.2Header <string> synopsis")#include <iosfwd> // for istream ([[istream.syn]](istream.syn "31.7.1Header <istream> synopsis")), ostream ([[ostream.syn]](ostream.syn "31.7.2Header <ostream> synopsis")), see [[iosfwd.syn]](iosfwd.syn "31.3.1Header <iosfwd> synopsis")namespace std {template<size_t N> class bitset; // [[bitset.operators]](bitset.operators "22.9.4bitset operators"), bitset operatorstemplate<size_t N>constexpr bitset<N> operator&(const bitset<N>&, const bitset<N>&) noexcept; template<size_t N>constexpr bitset<N> operator|(const bitset<N>&, const bitset<N>&) noexcept; template<size_t N>constexpr bitset<N> operator^(const bitset<N>&, const bitset<N>&) noexcept; template<class charT, class traits, size_t N> basic_istream<charT, traits>&operator>>(basic_istream<charT, traits>& is, bitset<N>& x); template<class charT, class traits, size_t N> basic_ostream<charT, traits>&operator<<(basic_ostream<charT, traits>& os, const bitset<N>& x);}