operator< (<vector>)

如果在运算符左侧的对象与右侧,的对象小于测试。

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

参数

  • _Left
    类型 vector对象。

  • _Right
    类型 vector对象。

返回值

true,如果在运算符左侧的向量与运算符右侧的向量小于;否则 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>

命名空间: std

请参见

参考

vector::operator<

标准模板库