The C++ Standard Template Library conveniently implements many templated standard classes and algorithms for us. The containers library contains several data structures.

Why even use these? Implementing these structures is one thing, but optimising them for performance is another. There’s an enormous amount of research in C++ data structures alone (especially in hash maps)1 that make them much more performance efficient compared to structures we implement.

for (auto& item : numbers) is equivalent to for i in list in Python; this allows us to loop over an entire STL container.

Generally: if we want to check if something exists with find(search-val), we can check if it’s at end().

Included structures

Resources

Footnotes

  1. This blog post on hash map benchmarking is pretty cool.