-
Book Overview & Buying
-
Table Of Contents
Data Structures and Algorithms with the C++ STL
By :
std::list is a doubly linked list. Unlike the previous containers, it does not store its elements contiguously. This means you lose out on the cache-friendliness but gain immense flexibility. Insertions and deletions, regardless of position, are a constant-time operation as long as you have an iterator to the position. However, access time is linear, making it less suited for tasks where random access is frequent. std::list is best suited for scenarios where the dataset experiences frequent insertions and deletions from both the middle and the ends, and direct access isn’t a priority.
std::list is a doubly-linked list provided by the STL. Its strengths include the following:
It’...