Containers
Containers in the context of the C++ standard library are a set of common data structures. These structures take the form of lists, stacks, arrays, and more. Containers can store data and objects and can be categorized into a few different types. These types, and the container classes associated with them, are sequential containers—string, vector, list, deque, and array.
A String Is a Container
In C++, strings are a class type, meaning that they are an object that has member variables and functions to act upon them; they are a container in the standard library just like any other. Underneath the string class interface is a C-style character array, and the string class provides the functionality to access a single byte in this sequence. The benefit of using strings over standard character arrays is that a lot of the algorithms that can be used in other containers, such as sorting and searching, can also be applied to strings. If we were to use a standard C-style...