std::__detail::...2_rehash_policy(3cxx)

πŸ’– std::__detail::_Power2_rehash_policy πŸ’–

okay bestie, sit down, because we're talking about a libstdc++ internal β€” the kind of thing you find in the 3cxx section of the manual, i.e. C++ library docs. she's from <hashtable_policy.h> and she's lowkey iconic. πŸŽ€


✨ NAME ✨

std::__detail::_Power2_rehash_policy β€” Rehash policy providing power of 2 bucket numbers. Avoids modulo operations.

that's it, that's the whole vibe. power-of-two buckets so we can dodge the modulo math. no cap. πŸ¦‹


🌸 SYNOPSIS 🌸

#include <hashtable_policy.h>

🧚 Public Types

  • using __has_load_factor = true_type β€” yes girl, she has a load factor, it's literally true_type. πŸ’…
  • typedef std::size_t _State β€” the state type is just std::size_t. keep it simple bestie.

πŸ’œ Public Member Functions

  • _Power2_rehash_policy(float __z = 1.0) noexcept β€” constructor, takes a float __z that defaults to 1.0, and she's noexcept about it. unbothered. 🫢
  • std::size_t _M_bkt_for_elements(std::size_t __n) const noexcept β€” tells you how many buckets you'd need for __n elements. const, noexcept, queen behavior.
  • std::pair<bool, std::size_t> _M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt, std::size_t __n_ins) noexcept β€” the big one: do we need to rehash?? returns a std::pair<bool, std::size_t> because of course it does.
  • std::size_t _M_next_bkt(std::size_t __n) noexcept β€” next bucket count, pls. πŸ“¦
  • void _M_reset() noexcept β€” reset her. no args, no drama.
  • void _M_reset(_State __state) noexcept β€” reset her to a specific _State __state. πŸŒ€
  • _State _M_state() const noexcept β€” read the state back out. const, noexcept, flawless.
  • float max_load_factor() const noexcept β€” returns the max load factor as a float. ⭐

🌈 Public Attributes

  • float _M_max_load_factor β€” the max load factor, just vibing out in public.
  • std::size_t _M_next_resize β€” the next resize threshold. she's watching. πŸ‘€

πŸ‘‘ Static Public Attributes

  • static const std::size_t _S_growth_factor β€” the growth factor, static and const, as she should be. πŸ’€

πŸ’… Detailed Description πŸ’…

Rehash policy providing power of 2 bucket numbers. Avoids modulo operations.

fr fr that's the whole point β€” powers of two let the bucket math skip modulo entirely, which is the kind of optimization that makes you go oh she ate. πŸ”₯


πŸŽ€ Author πŸŽ€

Generated automatically by Doxygen for libstdc++ from the source code.

like, she wasn't even hand-written, Doxygen literally birthed her from the source. main character energy but make it automated. πŸ™ˆ


and that's the tea, bestie β€” this page lives in the 3cxx manual, comes to you courtesy of libstdc++ and the Doxygen machine that generated it straight from the source, so go forth and rehash responsibly. mwah. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from