bitset::operator!=

指定 bitset と非等値のターゲットの bitset をテストします。

bool operator !=(
   const bitset<N>& _Right
) const;

パラメーター

  • _Right
    非等値の対象 bitset と比較して bitset。

戻り値

bitsets が異なる場合true ; それらが同じ場合 false

解説

Bitsets はメンバー演算子関数によって非等値をテストする同じサイズである必要があります。

使用例

// bitset_op_NE.cpp
// compile with: /EHsc
#include <bitset>
#include <iostream>

int main( )
{
   using namespace std;

   bitset<5> b1 ( 7 );
   bitset<5> b2 ( 7 );
   bitset<5> b3 ( 2 );
   bitset<4> b4 ( 7 );

   if ( b1 != b2 )
      cout << "Bitset b1 is different from bitset b2." << endl;
   else
      cout << "Bitset b1 is the same as bitset b2." << endl;

   if ( b1 != b3 )
      cout << "Bitset b1 is different from bitset b3." << endl;
   else
      cout << "Bitset b1 is the same as bitset b3." << endl;

   // This would cause an error because bitsets must have the
   // same size to be tested
   // if ( b1 != b4 )
   //   cout << "Bitset b1 is different from bitset b4." << endl;
   // else
   //   cout << "Bitset b1 is the same as bitset b4." << endl;
}
  
  

必要条件

ヘッダー: <bitset>

名前空間: std

参照

関連項目

bitset Class