This lecture is concerned with Example Demos for the Standard Template Library (STL), including its containers, iterators, and algorithms.
We will see that callable objects and lambdas are very useful for programs that use the STL.
Glossary of Terms
-
STL:
The Standard Template Library is a subset of the C++ standard libraries. It provides a large set of containers, each with a defined iterator type, and a set of algorithms designed to operate on the containers. -
Container:
Template classes designed to hold instances of some type specified by an application. Each of the containers has correct copy, move, assignment, and destruction semantics. -
Iterator:
Iterators are smart pointers, each iterator type associated with a specific container. The iterator has the ability to sequence through elements in the container without users needing to know details about the container's structure. -
Algorithms:
standard functions that operator on containers, usually accepting a starting iterator, ending iterator, and a callable object that defines what happens as each element of the container is reached during a traversal.
-
Help with Projects:
-
Project #1
Single-user Test Harness. -
Project #2
Local Test Harness -
Project #3
Server Process Pools -
Project #4
Remote Multi-User Test Harness
-
Project #1
-
Synchronous Discussion:
- Find at least one place in your Project #3 or #4 code that loops through a collection, making modifications or collecting information from the elements. Replace that code with an STL Algorithm that accepts start and end iterators, and a callable object. You define code for the callable object to replace your original operations.
-
Standard Template Library (STL)
-
Lecture Take-aways:
The most important things we discussed today were: