operator== (set)

如果在运算符的左边设置的对象与右侧,设置的对象相等测试。

bool operator!==(
   const set <Key, Traits, Allocator>& _Left,
   const set <Key, Traits, Allocator>& _Right
);

参数

  • _Left
    类型 set对象。

  • _Right
    类型 set对象。

返回值

true,如果在运算符的左边设置的与运算符右侧的设置的相等;否则 false

备注

在设置的对象之间的比较根据其元素的比较pairwise。两组相等;如果它们具有相同元素数目,并且其各自的元素具有相同的值。否则为不相等。

示例

// set_op_eq.cpp
// compile with: /EHsc
#include <set>
#include <iostream>

int main( )
{
   using namespace std;
   set <int> s1, s2, s3;
   int i;

   for ( i = 0 ; i < 3 ; i++ )
   {
      s1.insert ( i );
      s2.insert ( i * i );
      s3.insert ( i );
   }

   if ( s1 == s2 )
      cout << "The sets s1 and s2 are equal." << endl;
   else
      cout << "The sets s1 and s2 are not equal." << endl;

   if ( s1 == s3 )
      cout << "The sets s1 and s3 are equal." << endl;
   else
      cout << "The sets s1 and s3 are not equal." << endl;
}
  
  

要求

标头: <set>

命名空间: std

请参见

参考

标准模板库