- bitset[meta header]
- std[meta namespace]
- bitset[meta class]
- function[meta id-type]
// operator==により、以下のオーバーロードが使用可能になる (C++20)
bool operator!=(const bitset<N>& rhs) const; // (1) C++03
bool operator!=(const bitset<N>& rhs) const noexcept; // (1) C++11
constexpr bool operator!=(const bitset<N>& rhs) const noexcept; // (1) C++23
*this
とrhs
を非等値比較する。
*this
とrhs
のいずれかのビット値が等しくなければtrue
、そうでなければfalse
を返す。
投げない。
- この演算子により、
operator!=
が使用可能になる (C++20)
#include <iostream>
#include <bitset>
int main()
{
std::bitset<4> bs1("1010");
std::bitset<4> bs2("1110");
if (bs1 != bs2) {
std::cout << "not equal" << std::endl;
}
else {
std::cout << "equal" << std::endl;
}
}
not equal
- P1614R2 The Mothership has Landed
- C++20での三方比較演算子の追加と、関連する演算子の自動導出
- P2417R2 A more constexpr bitset