Udostępnij za pośrednictwem


operator< (<deque>)

Tests if the deque object on the left side of the operator is less than the deque object on the right side.

bool operator<(
   const deque<Type, Allocator>& _Left,
   const deque<Type, Allocator>& _Right
);

Parameters

  • _Left
    An object of type deque.

  • _Right
    An object of type deque.

Return Value

true if the deque on the left side of the operator is less than and not equal to the deque on the right side of the operator; otherwise false.

Remarks

The comparison between deque objects is based on a pairwise comparison of their elements. The less-than relationship between two objects is based on a comparison of the first pair of unequal elements.

Example

// deque_op_lt.cpp
// compile with: /EHsc
#include <deque>
#include <iostream>

int main( ) 
{
   using namespace std; 
   deque <int> c1, c2;

   c1.push_back( 1 );
   c1.push_back( 2 );
   c1.push_back( 4 );

   c2.push_back( 1 );
   c2.push_back( 3 );

   if ( c1 < c2 )
      cout << "Deque c1 is less than deque c2." << endl;
   else
      cout << "Deque c1 is not less than deque c2." << endl;
}
Deque c1 is less than deque c2.

Requirements

Header: <deque>

Namespace: std

See Also

Reference

deque::operator== and deque::operator<

Standard Template Library

Other Resources

<deque> Members