hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

9.5K
active users

Šimon Tóth

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

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