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

๐Ÿ“ฆ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

okay so bestie, welcome to the std::unorde...:load_factor(3) page from the C++ Standard Libary manual (yes, โ€œLibaryโ€ โ€” weโ€™re keeping the typo, itโ€™s giving authentic). This oneโ€™s a lil baby page but itโ€™s lowkey important, so letโ€™s get into it. ๐Ÿ’…

๐ŸŽ€ NAME ๐ŸŽ€

std::unordered_set::load_factor โ€” std::unordered_set::load_factor. Thatโ€™s it. Thatโ€™s the name. The way it just repeats itself is so real.

โœจ Synopsis โœจ

Hereโ€™s the signature, bestie:

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

It returns the average number of elements per bucket, that is, size() divided by bucket_count(). Literally just that division. Math girlies rise. ๐Ÿงฎโœจ

๐ŸŒธ Parameters ๐ŸŒธ

(none) โ€” bestie, there are literally no parameters. Zero. Nada. The vibes are immaculate and empty. ๐Ÿซถ

๐Ÿ’– Return value ๐Ÿ’–

Average number of elements per bucket. Thatโ€™s the whole return. No cap.

๐Ÿฆ‹ Complexity ๐Ÿฆ‹

Constant. Like, constant constant. No surprises, no drama, just const energy. ๐Ÿ’€

๐Ÿ”ฅ See also ๐Ÿ”ฅ

  • max_load_factor โ€” manages maximum average number of elements per bucket (public member function). Go check her out, sheโ€™s the manager of vibes. ๐Ÿ‘‘

xoxo, your girl ๐Ÿ’– โ€” this page came from http://cppreference.com, dated 2024.06.10, and itโ€™s the std::unorde...:load_factor(3) page. Slay. ๐ŸŽ€

๐Ÿ“ฆ where this page comes from