vector

How to use iterators in C++ vector?

An iterator is used to move through the elements of a C++ Standard Library container (vector, set, map etc.). It is analogous to array indexes or pointers. This pointer-like object that can be incremented or decremented, de-referenced (using *), and compared against another iterator. Vector iterators are random-access iterators, meaning, they can be used to …

How to use iterators in C++ vector? Read More »

C++ vector::push_back() usage with example

In C++, the standard library provides us with vectors, which are dynamic arrays. It consists of multiple homogeneous objects, which can be accessed by their position in the vector. It is automatically resized (if needed). The vector::push_back(val) is a C++ Standard Library function which pushes/inserts the element val at the end of a vector. It …

C++ vector::push_back() usage with example Read More »

C++ vector::pop_back() usage with example

In C++, the standard library provides us with vectors, which are dynamic arrays. It consists of multiple homogeneous objects, which can be accessed by their position in the vector. It is automatically resized (if needed). The vector::pop_back() is a C++ Standard Library function which removes an element from the end of a vector. It effectively …

C++ vector::pop_back() usage with example Read More »

C++ vector::rend() usage with example

In C++, the standard library provides us with vectors, which are dynamic arrays. It consists of multiple homogeneous objects, which can be accessed by their position in the vector. It is automatically resized (if needed). The vector::rend() is a C++ Standard Library function which returns a reverse iterator pointing to the imaginary element preceding the …

C++ vector::rend() usage with example Read More »

Scroll to Top
[gravityforms id="5" description="false" titla="false" ajax="true"]