次の方法で共有


operator== (<deque>)

演算子の左側の deque のオブジェクトが右側のオブジェクトと等しい deque のテスト。

bool operator==(
   const deque<Type, Allocator>& _Left,
   const deque<Type, Allocator>& _Right
);

パラメーター

  • _Left
    deque 型のオブジェクト。

  • _Right
    deque 型のオブジェクト。

戻り値

演算子の左側の deque が演算子の右側の deque と等しいtrue ; それ false

解説

deque のオブジェクトの比較は、要素のペアに比較に基づいています。2 個の deques は、要素の数が同じで、対応する要素の値が同じ同じです。それ以外の場合は等しくありません。

使用例

// deque_op_eq.cpp
// compile with: /EHsc
#include <deque>
#include <iostream>

int main( ) 
{
   using namespace std;
   deque <int> c1, c2;

   c1.push_back( 1 );
   c2.push_back( 1 );

   if ( c1 == c2 )
      cout << "The deques are equal." << endl;
   else
      cout << "The deques are not equal." << endl;

   c1.push_back( 1 );
   if ( c1 == c2 )
      cout << "The deques are equal." << endl;
   else
      cout << "The deques are not equal." << endl;
}
  
  

必要条件

ヘッダー: <deque>

名前空間: std

参照

関連項目

deque::operator== と deque::operator<

標準テンプレート ライブラリ