So my question is: when exactly do you prefer
std::list
overstd::vector
?
When I need a sequential container in a performance-sensitive area and profiling shows std::list
is faster.
So far, this has never happened to me.
(I might be tempted to try std::list
first when I would have to store very big objects with lots of insertion/removal in the middle. However, in practice, I’ve never come across such a use-case.)