std :: deque may work better for large containers, since it is usually implemented as a linked sequence of adjacent data blocks, unlike the one block used in std::vector . Thus, pasting in the middle will reduce the amount of data being copied from one place to another and potentially less redistribution.
Of course, it depends or depends on the size of the containers and the cost of copying the saved items. With the semantics of C ++ 11 relocation, the cost of the latter is less important. But, in the end, the only way to learn is by profiling with a realistic application.
source share