Chapter 16

The Standard Library

Images

Cippi admires the ISO Standard.

Despite the standard library’s crucial importance, this section is not exhaustive. Many rules are missing, the mentioned rules are often quite concise, other rules are already the topic of other parts of the C++ Core Guidelines. Consequently, I complement those rules with additional information when necessary.

Containers

Let me start with a significant rule.

SL.con.1

Prefer using STL array or vector instead of a C-array

I assume that you know about std::vector. Why should you prefer std::vector to a C-array?

std::vector

One of the big advantages of a std::vector compared ...

Get C++ Core Guidelines Explained: Best Practices for Modern C++ 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.