BLUF
C++ containers are a set of data structures that are used to store and organize collections of data. There are several different types of containers available in C++, each with its own set of features and characteristics.
Here are some common C++ containers:
Arrays: A fixed-size container that can store a collection of elements of the same data type in contiguous memory.
Vectors: A dynamic array that can grow or shrink as elements are added or removed. Vectors are similar to arrays but provide additional functionality, such as the ability to resize the container dynamically.
Lists: A container that stores elements in a linked list. Lists are efficient for inserting or removing elements at any position, but accessing elements is slower than with arrays or vectors.
Maps: A container that stores key-value pairs in a sorted order. Maps are efficient for searching and retrieving data based on a key.
Sets: A container that stores unique elements in a sorted order. Sets are useful when you need to maintain a collection of elements without duplicates.
Queues: A container that stores elements in a FIFO (first-in, first-out) order. Queues are useful when you need to process elements in the order they were added.
Stacks: A container that stores elements in a LIFO (last-in, first-out) order. Stacks are useful when you need to process elements in reverse order.
Each of these containers has its own set of methods and functions that can be used to manipulate the data it stores. For example, you can add elements to a vector using the push_back
method, or remove elements from a list using the erase
method. Choosing the right container for your needs depends on the specific requirements of your program, such as the type of data being stored, the operations that need to be performed, and the expected size and complexity of the container.
\uD83D\uDCD8 Outline
\uD83D\uDCCB To Do
Containers Active Reading
Review Student Notes
Complete Lab 1 and 2