cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : STL Containers : vector : operators
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forum
Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
STL Containers
bitset
deque
list
map
multimap
multiset
priority_queue
queue
set
stack
vector
vector
comparison operators
vector::vector
vector::~vector
member functions:
· vector::assign
· vector::at
· vector::back
· vector::begin
· vector::capacity
· vector::clear
· vector::empty
· vector::end
· vector::erase
· vector::front
· vector::get_allocator
· vector::insert
· vector::max_size
· vector::operator=
· vector::operator[]
· vector::pop_back
· vector::push_back
· vector::rbegin
· vector::rend
· vector::reserve
· vector::resize
· vector::size
· vector::swap

-

comparison operators function
template <class T, class Allocator>
  bool operator== ( const vector<T,Allocator>& x, const vector<T,Allocator>& y );
template <class T, class Allocator>
  bool operator< ( const vector<T,Allocator>& x, const vector<T,Allocator>& y );
template <class T, class Allocator>
  bool operator!= ( const vector<T,Allocator>& x, const vector<T,Allocator>& y );
template <class T, class Allocator>
  bool operator> ( const vector<T,Allocator>& x, const vector<T,Allocator>& y );
template <class T, class Allocator>
  bool operator>= ( const vector<T,Allocator>& x, const vector<T,Allocator>& y );
template <class T, class Allocator>
  bool operator<= ( const vector<T,Allocator>& x, const vector<T,Allocator>& y );
<vector>

Global comparison operator functions

These overloaded global operator functions perform the appropriate comparison operation between vector containers x and y.

Operations == and != are performed by comparing the elements using algorithm equal.

Operations <, >, <= and >= are performed by using algorithm lexicographical_compare, which requires that the type of the elements (T) has the < operation (less-than) defined between two objects of that type.

These operators are overloaded in header <vector>. The same operators are overloaded for the vector<bool> specialization.

Parameters

x, y
vector containers, having both the same template parameters (T and Allocator).

Return Value

true if the condition holds, and false otherwise.

© The C++ Resources Network, 2000-2007 - All rights reserved
Spotted an error? - contact us