October 1999
Beginner
304 pages
7h 11m
English
The following operations are common to all the container classes (as well as the string class):
The equality (==) and inequality (!=) operators return true or false.
The assignment (=) operator copies one container into another.
empty() returns true if the container holds no elements.
size() returns a count of the elements currently held within the container.
clear() deletes all the elements.
The following function exercises each of these operations:
void comp( vector<int> &v1, vector<int> &v2 ) { // are the two vectors equal? if ( v1 == v2 ) return; // is either vector empty? if ( v1.empty() || v2.empty() ) return; // no point defining it unless we are going to use it! vector<int> t; // assign t the largest ...Read now
Unlock full access