Standard Template Library
Course objectives
After completing this course you will be able to:
- choose the optimal container depending on the context
- use available iterators and write your own iterators
- optimally select the algorithm for data processing in the application
- use standard algorithms (also in the concurrent version - Parallel STL)
- use Ranges library in C++20
Course syllabus
Architecture of the STL
- Overview of STL architecture
- Requirements for container elements
- Value semantics vs. move semantics
- Emplace operations in standard containers (C++11)
emplace()
,emplace_back()
- Errors and exceptions inside the STL
Sequence containers
- Vectors -
std::vector
- Deque -
std::deque
- Lists -
std::list
Associative containers
- Sets -
std::set
andstd::multiset
- Maps -
std::map
andstd::multimap
- Unordered containers -
std::unordered_set
andstd::unordered_map
- Providing implementation of a hash value for custom objects
Container adapters
- Stack -
std::stack
- Queue -
std::queue
- Priority queue -
std::priority_queue
- Use cases
Iterators
- Iterator categories
- Auxiliary iterators functions
- Iterator adapters
- Insert iterators
- Stream iterators
- Reverse iterators
- Move iterators
- Writing custom iterators
Standard algorithms
- Ranges
- lgorithms arguments – ranges, iterators, predicates and comparers
Function objects
- The concept of function object
- Lambda expressions and closures
- Predefined function objects
- Function adapters, methods adapters and function objects adapters
- Higher-order functions
STL algorithms
for_each()
algorithm- Nonmodifying algorithms – counting elements, minimum and maximum, searching elements
- Modifying algorithms – copying, transforming and replacing elements
- Removing algorithms
- Mutating algorithms
- Sorting algorithms
- Sorted range algorithms
- Numeric algorithms
Ranges library in C++20
- Algorithms accepting ranges as input parameters
- Sentinels
- Projections
- Views
- Generating Views
- Filtering Views
- Transforming Views
- Mutating Views
- Utilities for ranges and views
Prerequisites
Attendance of our Programming in C++ course or equivalent experience with C++