std::bitset::operator==, std::bitset::operator!= - cppreference.com (original) (raw)
| bool operator==( const bitset& rhs ) const; | (1) | (noexcept since C++11) (constexpr since C++23) |
|---|---|---|
| bool operator!=( const bitset& rhs ) const; | (2) | (noexcept since C++11) (until C++20) |
Returns true if all of the bits in *this and rhs are equal.
Returns true if any of the bits in *this and rhs are not equal.
| The != operator is synthesized from operator==. | (since C++20) |
|---|
[edit] Parameters
[edit] Return value
true if the value of each bit in *this equals the value of the corresponding bit in rhs, otherwise false.
true if !(*this == rhs), otherwise false.
[edit] Example
Compare given bitsets to determine if they are identical:
Output:
b1 == b2: true b1 == b3: false b1 != b3: true