In which scenario do I use a particular STL container?

c++, container-data-type, stl

Solution

This cheat sheet provides a pretty good summary of the different containers.

See the flowchart at the bottom as a guide on which to use in different usage scenarios:

Created by David Moore and licensed CC BY-SA 3.0

Problem

I've been reading up on STL containers in my book on C++, specifically the section on the STL and its containers. Now I do understand each and every one of them have their own specific properties, and I'm close to memorizing all of them... But what I do not yet grasp is in which scenario each of them is used. What is the explanation? Example code is much prefered.

Original source

Related problems