operator<= (multiset)

测试,如果运算符左侧的多个对象设置小于或等于右侧的多个集合对象。

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

参数

  • _Left
    multiset 类型的对象。

  • _Right
    multiset 类型的对象。

返回值

true,如果运算符左侧的多重集是小于或等于多集位于运算符的右侧;为 false

备注

如果在多重集对象之间的比较基于元素的一种比较成对。 小于或等于两个对象之间的关系。根据第一个不相等对比较元素。

示例

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

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

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

   if ( s1 <= s2 )
      cout << "The multiset s1 is less than "
           << "or equal to the multiset s2." << endl;
   else
      cout << "The multiset s1 is greater than "
           << "the multiset s2." << endl;

   if ( s1 <= s3 )
      cout << "The multiset s1 is less than "
           << "or equal to the multiset s3." << endl;
   else
      cout << "The multiset s1 is greater than "
           << "the multiset s3." << endl;

   if ( s1 <= s4 )
      cout << "The multiset s1 is less than "
           << "or equal to the multiset s4." << endl;
   else
      cout << "The multiset s1 is greater than "
           << "the multiset s4." << endl;
}
  

要求

标头: <set>

命名空间: std

请参见

参考

标准模板库