floss.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
For people who care about, support, and build Free, Libre, and Open Source Software (FLOSS).

Administered by:

Server stats:

692
active users

std::vector is the quintessential C++ data structure.

It offers random access, low memory overhead and, due to the linear layout, is cache and branch-predictor friendly. This makes it often outperform more complex data structures.

Whenever picking a storage container, std::vector should be your first choice.

Compiler Explorer link: compiler-explorer.com/z/ch5dqb

Am I?

@simontoth
Except for situations where randomly allocating and potentially throwing is a problem for your use case 😉