다음을 통해 공유


operator==(<vector>)

Tests if the object on the left side of the operator is equal to the object on the right side.

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

매개 변수

  • _Left
    An object of type vector.

  • _Right
    An object of type vector.

반환 값

true if the vector on the left side of the operator is equal to the vector on the right side of the operator; otherwise false.

설명

Two vectors are equal if they have the same number of elements and their respective elements have the same values. 그렇지 않으면 두 개체는 서로 다른 개체입니다.

예제

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

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

   if ( v1 == v2 )
      cout << "Vectors equal." << endl;
   else
      cout << "Vectors not equal." << endl;
}
  

요구 사항

헤더: <벡터>

네임스페이스: std

참고 항목

참조

vector::operator==

표준 템플릿 라이브러리