operator<= (<queue>)

如果在运算符左侧的队列对象小于或等于右侧,的队列对象测试。

bool operator<=(
   const queue <Type, Container>& _Left,
   const queue <Type, Container>& _Right,
);

参数

  • _Left
    类型 queue对象。

  • _Right
    类型 queue对象。

返回值

true,如果在运算符左侧的队列与运算符右侧的队列严格小于;否则 false

备注

在队列对象之间的比较根据其元素的比较pairwise。小于或等于两个队列对象之间的关系于比较的第一对不相等元素。

示例

// queue_op_le.cpp
// compile with: /EHsc
#include <queue>
#include <iostream>

int main( )
{
   using namespace std;
   queue <int> q1, q2, q3;

   q1.push( 5 );
   q1.push( 10 );
   q2.push( 1 );
   q2.push( 2 );
   q3.push( 5 );
   q3.push( 10 );

   if ( q1 <= q2 )
      cout << "The queue q1 is less than or equal to "
           << "the queue q2." << endl;
   else
      cout << "The queue q1 is greater than "
           << "the queue q2." << endl;

   if ( q1 <= q3 )
      cout << "The queue q1 is less than or equal to "
           << "the queue q3." << endl;
   else
      cout << "The queue q1 is greater than "
           << "the queue q3." << endl;
}
  
  

要求

标头: <queue>

命名空间: std

请参见

参考

标准模板库