Aracılığıyla paylaş


operator<= (<iterator>)

Yineleyici işlecinin sol tarafındaki nesnesinin sınamaları küçük veya eşit Yineleyici nesneye sağ tarafındaki olur.

template<class RandomIterator>
   bool operator<=(
      const reverse_iterator<RandomIterator>& _Left,
      const reverse_iterator<RandomIterator>& _Right
   );

Parametreler

  • _Left
    Tür Yineleyici bir nesne.

  • _Right
    Tür Yineleyici bir nesne.

Dönüş Değeri

gerçek deyiminin sol tarafındaki Yineleyici Yineleyici ifade; sağ tarafındaki küçük veya eşit olması durumunda yanlış sağdaki Yineleyici daha büyükse.

Notlar

Bir yineleyici ya da başka bir eşit aynı öğe adresleri ya da oluşan önceki öğenin daha kapsayıcı öğe Yineleyici nesnesi tarafından gönderilen nesnesidir.Kapsayıcı Yineleyici nesnesi tarafından gönderilen öğeyi daha ilerisindeki oluşan bir öğe adresleri değişirse bir yineleyici baþka birinden büyük nesnesidir.

Örnek

// iterator_op_le.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;

   vector <int>::reverse_iterator rVPOS1 = vec.rbegin ( ) + 1, 
           rVPOS2 = vec.rbegin ( );
   
   cout << "The iterator rVPOS1 initially points to the "
           << "second element\n in the reversed sequence: "
           << *rVPOS1 << "." << endl;

   cout << "The iterator rVPOS2 initially points to the "
           << "first element\n in the reversed sequence: "
           << *rVPOS2 << "." << endl;

   if ( rVPOS1 <= rVPOS2 )
      cout << "The iterator rVPOS1 is less than or "
              << "equal to the iterator rVPOS2." << endl;
   else
      cout << "The iterator rVPOS1 is greater 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 or "
              << "equal to the iterator rVPOS2." << endl;
   else
      cout << "The iterator rVPOS1 is greater than "
              << "the iterator rVPOS2." << endl;
}
  
  
  
  
  
  

Gereksinimler

Başlık: <iterator>

Namespace: std

Ayrıca bkz.

Başvuru

Standart Şablon Kütüphanesi