std::bitset<N>::operator&=,|=,^=,~ (3) - Linux Manuals
std::bitset<N>::operator&=,|=,^=,~: std::bitset<N>::operator&=,|=,^=,~
NAME
std::bitset<N>::operator&=,|=,^=,~ - std::bitset<N>::operator&=,|=,^=,~
Synopsis
bitset<N>& operator&=( const bitset<N>& other ); (1)
bitset<N>& operator|=( const bitset<N>& other ); (2)
bitset<N>& operator^=( const bitset<N>& other ); (3)
bitset<N> operator~() const; (4)
Performs binary AND, OR, XOR and NOT.
1) Sets the bits to the result of binary AND on corresponding pairs of bits of *this and other.
2) Sets the bits to the result of binary OR on corresponding pairs of bits of *this and other.
3) Sets the bits to the result of binary XOR on corresponding pairs of bits of *this and other.
4) Returns a temporary copy of *this with all bits flipped (binary NOT).
Note that &=, |=, and ^= are only defined for bitsets of the same size N.
Parameters
other - another bitset
Return value
1-3) *this
4) bitset<N>(*this).flip()
Exceptions
(none) (until C++11)
noexcept specification: (since C++11)
noexcept
Example
// Run this code
Output:
See also
operator<<= performs binary shift left and shift right
operator>>= (public member function)
operator<<
operator>>