When should we use flat containers, and when should we use usual ones? Well, it's up to you, but here is a list of differences from the official documentation of Boost.Container that will help you to decide:
- A faster lookup than standard associative containers
- Much faster iteration than standard associative containers
- Less memory consumption for small objects (and for big objects if shrink_to_fit is used)
- Improved cache performance (data is stored in contiguous memory)
- Nonstable iterators (iterators are invalidated when inserting and erasing elements)
- Non-copyable and non-movable value types can't be stored
- Weaker exception safety than standard associative containers (copy/move constructors can throw an exception when shifting ...