|
|
|
|
|
by dietrichepp
4189 days ago
|
|
The problem with std::list is that it's almost always worse than the alternatives. I would recommend using std::vector as the "default" container, and then use another container if the performance of std::vector is not good enough. Or, put another way, I think std::list is a premature optimization, because you are saying that insertions and deletions are frequent enough that you need them to be O(1), even at the expense of extra memory usage and tons of cache misses for simple traversal. The std::vector container will outperform std::list surprisingly often. Just think of std::vector as your default container. |
|