std::__detail:...e_rehash_policy(3cxx)

πŸ‘‘ NAME πŸ‘‘

std::__detail::_Prime_rehash_policy β€” bestie, this is the default value for rehash policy. And the bucket size? It's (usually) the smallest prime that keeps the load factor small enough. Primes, we love to see it. ✨

(also hi, this whole thing lives in the 3cxx manual, i.e. the C++ library pages, iykyk πŸ¦‹)


πŸŽ€ SYNOPSIS πŸŽ€

#include <hashtable_policy.h>

🌸 Public Types 🌸

  • using __has_load_factor = true_type β€” it's true_type, which means this policy has a load factor. Confirmed, no notes. βœ…
  • typedef std::size_t _State β€” the state type is literally just a std::size_t. Simple, effective, unbothered. 🫢

πŸ’… Public Member Functions πŸ’…

  • _Prime_rehash_policy (float __z=1.0) noexcept β€” constructor moment!! takes a float __z that defaults to 1.0, and it's noexcept, so it will not be throwing hands. 😌
  • std::size_t _M_bkt_for_elements (std::size_t __n) const β€” takes __n, a std::size_t, and hands you back a std::size_t. It's const, so it stays in its lane and touches nothing. ✨
  • std::pair< bool, std::size_t > _M_need_rehash (std::size_t __n_bkt, std::size_t __n_elt, std::size_t __n_ins) const β€” three args, all std::size_t, named __n_bkt, __n_elt and __n_ins, and it returns a std::pair< bool, std::size_t >. Also const. The name says need rehash, so make of that what you will. πŸ‘€
  • std::size_t _M_next_bkt (std::size_t __n) const β€” __n in, std::size_t out, const the whole time. πŸ’…
  • void _M_reset () noexcept β€” no args, returns void, and it's noexcept. Just... reset. 🧼
  • void _M_reset (_State __state) β€” the overload that takes a _State __state and returns void. Two resets, one queen. πŸ‘‘
  • _State _M_state () const β€” gives you back a _State, and yeah it's const. πŸ“Έ
  • float max_load_factor () const noexcept β€” returns a float, const, noexcept. Max load factor, served fresh. πŸ“

🌈 Public Attributes 🌈

  • float _M_max_load_factor β€” a float, just vibing out in public like that. πŸ’–
  • std::size_t _M_next_resize β€” a std::size_t, also out here in the open. The audacity, the confidence. ✨

⭐ Static Public Attributes ⭐

  • static const std::size_t _S_growth_factor β€” static, const, std::size_t. It's giving constant, it's giving shared across everything. Iconic. πŸ”₯

πŸ¦‹ Detailed Description πŸ¦‹

So, to recap the whole lore: this is the default value for rehash policy, and the bucket size is (usually) the smallest prime that keeps the load factor small enough. That's it, that's the thesis. 🌸


✨ Author ✨

Generated automatically by Doxygen for libstdc++ from the source code. Not a human, not a bestie, just a robot doing its little thing. πŸ€–πŸ’œ


okay that's the page!! 🫢 the footer at the very bottom is the classic combo β€” the libstdc++ source name, the 3cxx manual section, and the page date riding along with it, exactly as it shipped. mwah, go rehash something responsibly. πŸ’…

πŸ“¦ where this page comes from