Vector operations - summary

Operation Meaning
V.empty() Returns true, if V has no elements. Otherwise, it returns false.
V.size() Returns the number of elements in V, i.e. $0$ or more.
V.push_back(e) Adds an element with value e to the end of V.
V.pop_back() Removes the last element of V. Calling pop_back on an empty vector results in undefined behavior.
V.clear() Removes all elements from V, i.e. V.size() becomes $0$.
V[i] Returns the element with subscript $i$, i.e. the $(i+1)$th element stored in the vector.
V1 = V2 Replaces the elements in vector V1 with a copy of the elements in vector V2.
V1 == V2 Returns true, if V1.size() is equal to V2.size() and V1[0] == V2[0], V1[1] == V2[1], $\cdots$, V1[V1.size()-1] == V2[V2.size()-1]. Otherwise, it returns false.
V1 != V2 Returns true, if V1 == V2 returns false. Otherwise, it returns false.

Finally, it’s important to remember that the first element of a vector has subscript zero (i.e. V[0]), while the last element of the vector has subscript V.size()$-1$ (i.e. V[V.size()-1]).