© Will Briggs 2021
W. BriggsC++20 for Lazy Programmershttps://doi.org/10.1007/978-1-4842-6306-8_23

23. The Standard Template Library

Will Briggs1  
(1)
Lynchburg, VA, USA
 

Should every programmer make his/her own vector, list, and so on? Oh, of course not. So some time back, the Standard Template Library (STL) was put into the standard. In STL you’ll find containers like list and vector; strings, as we already use them; and commonly needed functions like swap, find, and copy.

You’ll also find an annoying emphasis on efficiency. I say “annoying” because STL promotes efficiency by disabling inefficient things. If you want to use operator[] with a list, you can forget it; it’s too slow (O(N) time, if you do O notation). If you want [], the makers of STL ...

Get C++20 for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners 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.