std::unorde...:load_factor(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

std::unorde...:load_factor(3) πŸ’…

okay so bestie, welcome to std::unorde...:load_factor(3) from the C++ Standard Libary manual β€” yes, that's the manual name, typo and all, I don't make the rules πŸŽ€βœ¨


🌸 NAME 🌸

The name is std::unordered_map::load_factor β€” and the NAME line is literally std::unordered_map::load_factor - std::unordered_map::load_factor, which is giving β€œI said what I said” energy πŸ’…


✨ Synopsis ✨

Here's the signature, copied exactly, no edits bestie:

float load_factor() const;  (since C++11)

It's been around since C++11, and this function returns the average number of elements per bucket, that is, size() divided by bucket_count(). That's the whole vibe: bucket math, but make it average πŸͺ£βœ¨


πŸŽ€ Parameters πŸŽ€

(none) β€” zero parameters, not a single one, periodt 🫢


πŸ’– Return value πŸ’–

Average number of elements per bucket. That's it, that's the return value, and it ate πŸ’–


πŸ¦‹ Complexity πŸ¦‹

Constant. No cap, it's constant complexity ⭐


πŸ‘‘ See also πŸ‘‘

  • max_load_factor β€” manages maximum average number of elements per bucket (public member function)

go check on her, she's iconic πŸ‘‘


mwah πŸ’‹ this page is from http://cppreference.com, with version/date 2024.06.10 β€” and the header title vibe is std::unorde...:load_factor(3). byeee, go divide your size() by your bucket_count() responsibly 🫢🌈

πŸ“¦ where this page comes from