operator!= (<iterator>)

반복기 개체 연산자의 왼쪽에서 오른쪽 반복기 개체와 일치 하지 않으면 테스트 합니다.

template<class RandomIterator>
   bool operator!=(
      const reverse_iterator<RandomIterator>& _Left,
      const reverse_iterator<RandomIterator>& _Right
   );
template<class Type, class CharType, class Traits, class Distance>
   bool operator!=(
      const istream_iterator<Type, CharType, Traits, Distance>& _Left,
      const istream_iterator<Type, CharType, Traits, Distance>& _Right
   );
template<class CharType, class Tr>
   bool operator!=(
      const istreambuf_iterator<CharType, Traits>& _Left,
      const istreambuf_iterator<CharType, Traits>& _Right
);

매개 변수

  • _Left
    개체 형식의 반복기.

  • _Right
    개체 형식의 반복기.

반환 값

true 이면 반복기 개체; 같지 않으면 false 이면 반복기 개체 같은 경우.

설명

게는 같은 컨테이너 요소를에서 해결 하는 경우 반복기 개체 하나를 같습니다.두 반복기 컨테이너에서 다른 요소를 가리키는 경우 다음 같지 않습니다.

예제

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

int main( )
{
   using namespace std;
   int i;

   vector<int> vec;
   for ( i = 1 ; i < 9 ; ++i )  
   {
      vec.push_back ( i );
   }
   
   vector <int>::iterator vIter;

   cout << "The 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 iterator rVPOS1 initially points to the first "
        << "element\n in the reversed sequence: "
        << *rVPOS1 << "." << endl;

   if ( rVPOS1 != rVPOS2 )
      cout << "The iterators are not equal." << endl;
   else
      cout << "The iterators are equal." << endl;

   rVPOS1++;
   cout << "The iterator rVPOS1 now points to the second "
        << "element\n in the reversed sequence: "
        << *rVPOS1 << "." << endl;

   if ( rVPOS1 != rVPOS2 )
      cout << "The iterators are not equal." << endl;
   else
      cout << "The iterators are equal." << endl;
}
  
  
  
  
  

요구 사항

헤더: <iterator>

네임 스페이스: std

참고 항목

참조

표준 템플릿 라이브러리