共用方式為


operator> (<vector>)

測試,如果在運算子左方的物件大於右邊的物件。

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

參數

  • _Left
    型別 vector物件。

  • _Right
    型別 vector物件。

傳回值

true ,如果在運算子左方的向量大於向量在運算子右方的;否則 false

範例

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

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

   v2.push_back( 1 );
   v2.push_back( 2 );
   v2.push_back( 2 );

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

需求

標頭: <vector>

命名空間: std

請參閱

參考

標準樣板程式庫