다음을 통해 공유


operator<=(<queue>)

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

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

매개 변수

  • _Left
    An object of type queue.

  • _Right
    An object of type queue.

반환 값

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.

설명

The comparison between queue objects is based on a pairwise comparison of their elements. The less than or equal to relationship between two queue objects is based on a comparison of the first pair of unequal elements.

예제

// 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;
}
  

요구 사항

Header: <queue>

네임스페이스: std

참고 항목

참조

표준 템플릿 라이브러리