Containers (Modern C++)
By default, use vector as the default sequential container in C++. This is the equivalent of List<T> in other languages.
Use map (not unordered_map) as the default associative container. Use set, multimap, multiset for degenerate & multi cases.
When performance optimization is needed, consider using:
the array type when embedding is important, e.g., as a class member.
unordered_map, et al.: Lower per-element overhead (major) and constant-time lookup (minor because O(log N) INVALID USE OF SYMBOLS O(K)). Harder to use correctly and efficiently, because of inconveniences + sharp edges.
Sorted vector. (See: Algorithms.)
Don’t use C arrays. (For older APIs, use f( vec.data(), vec.size() ); .)