New Containers

C++11 adds the following containers: array, forward_list, unordered_set, and the unordered associative containers unordered_multiset, unordered_map, and unordered_multimap.

An array container, once declared, is fixed in size and uses static or stack memory rather than dynamically allocated memory. It’s intended as a substitute for the built-in array type; it’s more limited than vector, but more efficient.

The list container is a bidirectional linked list, with each item, other than the two ends, linked to the item before it and the one after. The forward_list is a singly linked list, with each item, other than the last, linked to the next item. It provides a more compact, but more limited, alternative for list.

Like set and the ...

Get C++ Primer Plus now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.