(GlobalCpp) How to Choose and Use the Right Container in C++26 p1
Details
Description
Choosing the right container and using it correctly can have a profound impact on the
performance of a program, but what may appear to be the obvious choice can turn out to
be the wrong one. In this two-part series, we will survey the containers and adaptors in the
C++26 Standard Library and discuss how to choose the right tool for the job and extract the
best performance from it.
We will explore the abstractions each container models and the practical limitations it
imposes. We will see that choosing between them requires an understanding not only of
the speed and size tradeoffs of each container, but also of the difference between
algorithmic complexity and actual behavior. Along the way, we will investigate aspects of
the original (C++98) STL container design principles that can often lead to the wrong
choice.
In the first session we will look at the block-based contiguous sequence containers
(vector and inplace\_vector), the block-based semi-contiguous sequence container
(deque), and the node-based (non-contiguous) sequence containers (list and
forward\_list). We will also discuss the sequence container adaptors.
About the Presenter
Alan Talbot is a software architect and engineer specializing in C++. He began his career as a pioneer in professional music notation software and later built engineering platforms for GIS data production and railroad simulation. He has been a C++ programmer since 1990 and an active member of the ISO C++ committee (WG21) since 2005, and has spoken at major C++ conferences for more than ten years. His C++ contribution
s have focused on runtime efficiency, including container emplacement, manipulation of associative container nodes, and unrestricted unions.

