Files
cppdraft_translate/cppdraft/bitset/operators.md
2025-10-25 03:02:53 +03:00

3.2 KiB
Raw Blame History

[bitset.operators]

22 General utilities library [utilities]

22.9 Bitsets [bitset]

22.9.4 bitset operators [bitset.operators]

🔗

template<size_t N> constexpr bitset<N> operator&(const bitset<N>& lhs, const bitset<N>& rhs) noexcept;

1

#

Returns: bitset(lhs) &= rhs.

🔗

template<size_t N> constexpr bitset<N> operator|(const bitset<N>& lhs, const bitset<N>& rhs) noexcept;

2

#

Returns: bitset(lhs) |= rhs.

🔗

template<size_t N> constexpr bitset<N> operator^(const bitset<N>& lhs, const bitset<N>& rhs) noexcept;

3

#

Returns: bitset(lhs) ^= rhs.

🔗

template<class charT, class traits, size_t N> basic_istream<charT, traits>& operator>>(basic_istream<charT, traits>& is, bitset<N>& x);

4

#

A formatted input function ([istream.formatted]).

5

#

Effects: Extracts up to N characters from is.

Stores these characters in a temporary object str of typebasic_string<charT, traits>, then evaluates the expressionx = bitset(str).

Characters are extracted and stored until any of the following occurs:

N characters have been extracted and stored;

end-of-file occurs on the input sequence;

the next input character is neitheris.widen('0') noris.widen('1') (in which case the input character is not extracted).

6

#

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.

7

#

Returns: is.

🔗

template<class charT, class traits, size_t N> basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const bitset<N>& x);

8

#

Returns: os << x.template to_string<charT, traits, allocator>( use_facet<ctype>(os.getloc()).widen('0'), use_facet<ctype>(os.getloc()).widen('1')) (see [ostream.formatted]).