operator== (<list>)
演算子の左側のオブジェクトが右側のオブジェクトと等しいかどうかを調べます。
bool operator==(
const list<Type, Allocator>& _Left,
const list<Type, Allocator>& _Right
);
パラメーター
_Left
**[リスト]**型のオブジェクト。_Right
**[リスト]**型のオブジェクト。
戻り値
演算子の左側の一覧が演算子の右側の一覧と等しいtrue ; それ false。
解説
リスト オブジェクトの比較は、要素のペアに比較に基づいています。2 種類のリストの要素の数が同じで、対応する要素の値が同じ同じです。それ以外の場合は等しくありません。
使用例
// list_op_eq.cpp
// compile with: /EHsc
#include <list>
#include <iostream>
int main( )
{
using namespace std;
list <int> c1, c2;
c1.push_back( 1 );
c2.push_back( 1 );
if ( c1 == c2 )
cout << "The lists are equal." << endl;
else
cout << "The lists are not equal." << endl;
}
必要条件
ヘッダー: <list>
名前空間: std