C++ Structured Template Library. As the name suggests, it is a library, which comes by default with you install any C++ compiler.
C++ STL has below 3 important components:
1. C++ Containers: Used to store the data in an organized way.
2. C++ Algorithms: Used to manipulate the data.
3. C++ Iterators: Used to access the data.
We shall study all the above 3 topics in details, via series of chapters:
It is recommended that you study the topics in the order in which they are written. In this chapter we shall have a look on high level introduction to all the 3 topics.
C++ Containers:
In general containers are used to hold certain type of goods. Similarly, C++ containers are used to store objects of certain types. You can use C++ Iterators to iterate over the containers.
There are 3 types of containers available:
1. Sequence Containers:
Here elements are stored sequentially, i.e. one after another according to their input.
Below are the list of sequence container available in C++
1. std::array: It represents static length continuous elements.
2. std:vector: It represents dynamic length continuous elements.
3. std::dequeue: It represents double ended queue.
4. std::forward_list: It represents Single Linked List.
5. std::list: It represents a double linked list.
2. Associative Containers:
In these types of container, the data will be stored in particular order, either in sorted fashion or a key-value pair. We should use these types on containers when we need a fast lookup.
Below are the list of Associative Containers:
1. std::set: Collection of unique elements called keys. Sorted by key.
2. std::multiset: Multiple copies of keys are allowed. Sorted by key.
3. std::map: Collection of unique key value pair. Sorted by key
4. std::multimap: Collection of multiple copies of key-value part. Sorted by key.
3. Unordered associative containers:
Here the values are not sorted according to the keys. But they are organized into different buckets depending upon the hash value. This helps in faster retrieval of the data with the help of key value pair.
Below are the list of Associative Containers:
1. std::unordered_set: Contains collection of unique keys.
2. std::unordered_multiset: Duplicate keys are allowed.
3. std::unordered_map: Collection of unique key-value pairs
4. std:: unordered_multimap: Duplicate key-value pairs are allowed.
4. C++ adapters:
1. Stack
2. Queue
3. Priority Queue
2. C++ Algorithms:
1. Non modifying sequence operation algorithms
2. Modifying sequence operation algorithms
3. Partition Operation algorithms
4. Sorting Algorithms
5. Merging on sorted element algorithms
6. Sequence algorithm on partitioned or sorted ranges
7. Heap Algorithms
8. Min/Max algorithms
9. Other algorithms