Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

operator< (<vector>)

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

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

An object of type vector.

_Right

An object of type vector.

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

// vector_op_lt.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>

int main( )
{
   using namespace std; 
   
   vector <int> v1, v2;
   v1.push_back( 1 );
   v1.push_back( 2 );
   v1.push_back( 4 );

   v2.push_back( 1 );
   v2.push_back( 3 );

   if ( v1 < v2 )
      cout << "Vector v1 is less than vector v2." << endl;
   else
      cout << "Vector v1 is not less than vector v2." << endl;
}
Vector v1 is less than vector v2.

Header: <vector>

Namespace: std

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.