107 lines
3.2 KiB
Markdown
107 lines
3.2 KiB
Markdown
[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.3 Formatted 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.3 Formatted output functions"))[.](#8.sentence-1)
|