New (and Old) Standard Library Containers: How to Choose the Right Container in C++26 and Beyond

By Alan Talbot

Choosing the right container and using it correctly can have a profound impact on the performance of a program. The many containers in the C++ Standard Library exist largely because they provide different performance profiles. Choosing between them requires an understanding of the speed and size tradeoffs of each container and the difference between algorithmic complexity and actual behavior. Unfortunately, partly for historical reasons, the APIs of the Standard Library containers can be misleading in this regard. They are also a moving target: C++26 will provide two new containers (the first since C++11), and C++23 provided four new container adaptors. Improvements to containers appear in every new version of C++, and there are at least two container proposals in the early stages, targeted at C++29 or beyond.

In this talk we will look at the new containers and adaptors in the context of the existing library. We will analyze all the containers to determine the abstractions they are meant to express and the practical limitations they impose, with an eye to understanding how to select the best solution for the problem at hand. We will then look at the proposals for future containers, discuss the proposed designs, and consider whether they would add sufficient value to justify the considerable Committee time necessary to make them part of the Standard Library.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.