STL

vector::pop_back() function in C++

In C++, the vector class provides a function pop_back(). It removes the last element from the calling vector object. Table Of Contents Syntax of vector::pop_back(): Example of vector::pop_back() function Calling vector::pop_back() function on empty vector Remove all elements from vector using vector::pop_back() Summary Syntax of vector::pop_back(): Parameters: None Return value: None It accepts no argument, …

vector::pop_back() function in C++ Read More »

vector::clear() function in C++

In C++, the vector class provides a function clear(). It removes all elements from the calling vector object. It will make the size of vector 0. Table Of Contents Syntax of vector::clear(): Examples of vector::clear() Example 1 Example 2 Summary Syntax of vector::clear(): Parameters: None Return value: None Examples of vector::clear() Let’s see some examples …

vector::clear() function in C++ Read More »

Convert a string to a vector of chars in C++

In this article, we will discuss different ways to convert a string to a vector of chars in C++. Table Of Contents Method 1: Using Vector’s range constructor Method 2: Using copy() function Summary Method 1: Using Vector’s range constructor Create two iterators pointing to the first, and one past the last characters of string. …

Convert a string to a vector of chars in C++ Read More »

Scroll to Top