共用方式為


operator>= (<queue>)

Tests if the queue object on the left side of the operator is greater than or equal to the queue object on the right side.

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

Parameters

  • _Left
    An object of type queue.

  • _Right
    An object of type queue.

Return Value

true if the queue on the left side of the operator is strictly less than the queue on the right side of the operator; otherwise false.

Remarks

The comparison between queue objects is based on a pairwise comparison of their elements. Two queues are equal if they have the same number of elements and their respective elements have the same values. Otherwise, they are unequal.

Example

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

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

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


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

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

Requirements

Header: <queue>

Namespace: std

See Also

Reference

Standard Template Library