共用方式為


bitset::operator!=

為具有指定的 bitset 不相等測試的目標 bitset。

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

參數

  • _Right
    要與比較的目標 bitset 比較的 bitset。

傳回值

true ,如果 bitsets 不同; 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 類別