operator< (<iterator>)
Sınamaları işlecinin sol tarafındaki Yineleyici nesneyi sağ tarafındaki Yineleyici nesne küçüktür.
template<class RandomIterator>
bool operator<(
const reverse_iterator<RandomIterator>& _Left,
const reverse_iterator<RandomIterator>& _Right
);
Parametreler
_Left
Bir nesne türü Yineleyici._Right
Bir nesne türü Yineleyici.
Dönüş Değeri
gerçek Yineleyici deyiminin sol tarafındaki ifade; sağ tarafında Yineleyici azsa yanlış 'den büyük veya eşit Yineleyici sağdaki ise.
Notlar
Kapsayıcı Yineleyici nesnesi tarafından gönderilen öğeyi daha önceki bölümlerinde yer alan oluşan bir öğe adresleri değişirse bir yineleyici nesne başka azdır.Aynı öğe Yineleyici nesne olarak ya da Yineleyici nesnesi tarafından gönderilen öğe'den kapsayıcısındaki daha sonra ortaya çıkan bir öğe adresleri değişirse bir yineleyici nesne başka az değil.
Örnek
// iterator_op_lt.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <iostream>
int main( )
{
using namespace std;
int i;
vector<int> vec;
for ( i = 0 ; i < 6 ; ++i )
{
vec.push_back ( 2 * i );
}
vector <int>::iterator vIter;
cout << "The initial vector vec is: ( ";
for ( vIter = vec.begin( ) ; vIter != vec.end( ); vIter++)
cout << *vIter << " ";
cout << ")." << endl;
// Initializing reverse_iterators to the last element
vector <int>::reverse_iterator rVPOS1 = vec.rbegin ( ),
rVPOS2 = vec.rbegin ( );
cout << "The iterators rVPOS1& rVPOS2 initially point to the "
<< "first element\n in the reversed sequence: "
<< *rVPOS1 << "." << endl;
if ( rVPOS1 < rVPOS2 )
cout << "The iterator rVPOS1 is less than"
<< " the iterator rVPOS2." << endl;
else
cout << "The iterator rVPOS1 is not less than"
<< " the iterator rVPOS2." << endl;
rVPOS2++;
cout << "The iterator rVPOS2 now points to the second "
<< "element\n in the reversed sequence: "
<< *rVPOS2 << "." << endl;
if ( rVPOS1 < rVPOS2 )
cout << "The iterator rVPOS1 is less than"
<< " the iterator rVPOS2." << endl;
else
cout << "The iterator rVPOS1 is not less than"
<< " the iterator rVPOS2." << endl;
}
Gereksinimler
Başlık: <iterator>
Namespace: std