Back to Basics
Standard Library Containers
From a bird’s-eye view, the Standard Template Library (STL) consists of three components from a bird’s-eye view. Those
are containers, algorithms that run on the containers, and iterators that connect both of them. The STL has five sequential and eight associative containers. I hear your question:
* When should I use a sequence container or an associative one?
* When I decided for a sequence container or an associative one, which one should I use?
The answers to these questions depends mainly on two facts: use case and performance.
You may not know it but std::array and std::vector are your best friends for sequence containers, and you are most of the time fine with std::unordered_map when you need an associative container.
Rainer Grimm
Rainer has worked as a software architect, team lead, and instructor since 1999. In 2002, Rainer created a company-intern meeting for further education and had given training courses since 2002. Rainer's first tutorials were about proprietary management software, but he began teaching Python and C++ soon after. In his spare time, he likes to write articles about C++, Python, and Haskell and speak at conferences. Rainer publishes weekly on his English blog Modernes C++. Since 2016, Rainer has been an independent instructor, giving seminars about modern C++ and Python. Due to his profession, he constantly searches for the best way to teach modern C++. He published several books in various languages about modern C++ in the last ten years, including the last one "C++ Core Guidelines Explained: Best Practices for Modern C++".