...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::intrusive::bucket_plus_vtraits
// In header: <boost/intrusive/hashtable.hpp> template<typename ValueTraits, typename BucketTraits, bool LinearBuckets> struct bucket_plus_vtraits { // types typedef BucketTraits bucket_traits; typedef ValueTraits value_traits; typedef unordered_bucket_impl< value_traits >::type bucket_type; typedef unordered_bucket_ptr_impl< value_traits >::type bucket_ptr; typedef value_traits::node_traits node_traits; typedef bucket_type::node_traits slist_node_traits; typedef unordered_group_adapter< node_traits > group_traits; typedef group_functions< node_traits > group_functions_t; typedef unspecified slist_node_algorithms; typedef slist_node_traits::node_ptr slist_node_ptr; typedef trivial_value_traits< slist_node_traits, normal_link > slist_value_traits; typedef slist_iterator< slist_value_traits, false > siterator; typedef slist_iterator< slist_value_traits, true > const_siterator; typedef node_traits::node_ptr node_ptr; typedef node_traits::const_node_ptr const_node_ptr; typedef node_traits::node node; typedef value_traits::value_type value_type; typedef value_traits::pointer pointer; typedef value_traits::const_pointer const_pointer; typedef pointer_traits< pointer >::reference reference; typedef pointer_traits< const_pointer >::reference const_reference; typedef circular_slist_algorithms< group_traits > group_algorithms; typedef pointer_traits< typenamevalue_traits::pointer >::template rebind_pointer< constvalue_traits >::type const_value_traits_ptr; typedef pointer_traits< typenamevalue_traits::pointer >::template rebind_pointer< constbucket_plus_vtraits >::type const_bucket_value_traits_ptr; typedef unspecified linear_buckets_t; typedef bucket_plus_vtraits & this_ref; typedef hashtable_iterator< bucket_plus_vtraits, LinearBuckets, false > iterator; typedef hashtable_iterator< bucket_plus_vtraits, LinearBuckets, true > const_iterator; // member classes/structs/unions struct data_type : public ValueTraits, public BucketTraits { // construct/copy/destruct data_type(const ValueTraits &, const BucketTraits &); data_type(data_type &&); }; template<typename Disposer> struct typeof_node_disposer { // types typedef unspecified type; }; // construct/copy/destruct bucket_plus_vtraits(const ValueTraits &, const bucket_traits &); bucket_plus_vtraits(bucket_plus_vtraits &&); // public member functions const_value_traits_ptr priv_value_traits_ptr() const; const bucket_plus_vtraits & get_bucket_value_traits() const; bucket_plus_vtraits & get_bucket_value_traits(); const_bucket_value_traits_ptr bucket_value_traits_ptr() const; const value_traits & priv_value_traits() const; value_traits & priv_value_traits(); const bucket_traits & priv_bucket_traits() const; bucket_traits & priv_bucket_traits(); bucket_ptr priv_bucket_pointer() const noexcept; std::size_t priv_usable_bucket_count() const noexcept; bucket_type & priv_bucket(std::size_t) const noexcept; bucket_ptr priv_bucket_ptr(std::size_t) const noexcept; bucket_ptr priv_past_usable_bucket_ptr() const; bucket_ptr priv_invalid_bucket_ptr() const; void priv_set_sentinel_bucket() const; void priv_unset_sentinel_bucket() const; siterator priv_end_sit() const; siterator priv_end_sit(unspecified) const; siterator priv_end_sit(unspecified) const; siterator priv_bucket_lbegin(std::size_t) const; siterator priv_bucket_lbbegin(std::size_t) const; siterator priv_bucket_lend(std::size_t) const; std::size_t priv_bucket_size(std::size_t) const; bool priv_bucket_empty(std::size_t) const; bool priv_bucket_empty(bucket_ptr) const; template<typename NodeDisposer, bool OptimizeMultikey> std::size_t priv_erase_node_range(siterator const &, std::size_t const, siterator const &, std::size_t const, NodeDisposer, unspecified); template<typename Disposer> typeof_node_disposer< Disposer >::type make_node_disposer(const Disposer &) const; node & priv_value_to_node(reference); const node & priv_value_to_node(const_reference) const; node_ptr priv_value_to_node_ptr(reference); const_node_ptr priv_value_to_node_ptr(const_reference) const; reference priv_value_from_siterator(siterator); const_reference priv_value_from_siterator(siterator) const; void priv_clear_buckets(const bucket_ptr, const std::size_t); std::size_t priv_stored_or_compute_hash(const value_type &, unspecified) const; iterator end() noexcept; const_iterator end() const noexcept; const_iterator cend() const noexcept; iterator build_iterator(siterator, bucket_ptr); iterator build_iterator(siterator, bucket_ptr, unspecified); iterator build_iterator(siterator, bucket_ptr, unspecified); const_iterator build_const_iterator(siterator, bucket_ptr) const; const_iterator build_const_iterator(siterator, bucket_ptr, unspecified) const; const_iterator build_const_iterator(siterator, bucket_ptr, unspecified) const; // public static functions static siterator priv_bucket_lbegin(bucket_type &); static siterator priv_bucket_lbbegin(bucket_type &); static siterator priv_bucket_lend(bucket_type &); static std::size_t priv_bucket_size(const bucket_type &); static bool priv_bucket_empty(const bucket_type &); template<typename NodeDisposer> static std::size_t priv_erase_from_single_bucket(bucket_type &, siterator, siterator, NodeDisposer, unspecified); template<typename NodeDisposer> static std::size_t priv_erase_from_single_bucket(bucket_type &, siterator, siterator, NodeDisposer, unspecified); template<typename NodeDisposer> static void priv_erase_node(bucket_type &, siterator, NodeDisposer, unspecified); template<typename NodeDisposer> static void priv_erase_node(bucket_type &, siterator, NodeDisposer, unspecified); static siterator priv_get_last(bucket_type &, unspecified); static siterator priv_get_last(bucket_type &, unspecified); template<typename NodeDisposer> static std::size_t priv_erase_whole_bucket(bucket_type &, NodeDisposer); static siterator priv_get_previous(bucket_type &, siterator, unspecified); static siterator priv_get_previous(bucket_type &, siterator, unspecified); static bucket_ptr to_ptr(bucket_type &); static siterator sit_bbegin(bucket_type &); static siterator sit_begin(bucket_type &); static siterator sit_end(bucket_type &); static std::size_t priv_stored_hash(siterator, unspecified); static std::size_t priv_stored_hash(siterator, unspecified); static void priv_init_buckets(const bucket_ptr, const std::size_t); // public data members static const bool safemode_or_autounlink; static const std::size_t bucket_overhead; };
bucket_plus_vtraits
public member functionsconst_value_traits_ptr priv_value_traits_ptr() const;
const bucket_plus_vtraits & get_bucket_value_traits() const;
bucket_plus_vtraits & get_bucket_value_traits();
const_bucket_value_traits_ptr bucket_value_traits_ptr() const;
const value_traits & priv_value_traits() const;
value_traits & priv_value_traits();
const bucket_traits & priv_bucket_traits() const;
bucket_traits & priv_bucket_traits();
bucket_ptr priv_bucket_pointer() const noexcept;
std::size_t priv_usable_bucket_count() const noexcept;
bucket_type & priv_bucket(std::size_t n) const noexcept;
bucket_ptr priv_bucket_ptr(std::size_t n) const noexcept;
bucket_ptr priv_past_usable_bucket_ptr() const;
bucket_ptr priv_invalid_bucket_ptr() const;
void priv_set_sentinel_bucket() const;
void priv_unset_sentinel_bucket() const;
siterator priv_end_sit() const;
siterator priv_end_sit(unspecified) const;
siterator priv_end_sit(unspecified) const;
siterator priv_bucket_lbegin(std::size_t n) const;
siterator priv_bucket_lbbegin(std::size_t n) const;
siterator priv_bucket_lend(std::size_t n) const;
std::size_t priv_bucket_size(std::size_t n) const;
bool priv_bucket_empty(std::size_t n) const;
bool priv_bucket_empty(bucket_ptr p) const;
template<typename NodeDisposer, bool OptimizeMultikey> std::size_t priv_erase_node_range(siterator const & before_first_it, std::size_t const first_bucket, siterator const & last_it, std::size_t const last_bucket, NodeDisposer node_disposer, unspecified optimize_multikey_tag);
template<typename Disposer> typeof_node_disposer< Disposer >::type make_node_disposer(const Disposer & disposer) const;
node & priv_value_to_node(reference v);
const node & priv_value_to_node(const_reference v) const;
node_ptr priv_value_to_node_ptr(reference v);
const_node_ptr priv_value_to_node_ptr(const_reference v) const;
reference priv_value_from_siterator(siterator s);
const_reference priv_value_from_siterator(siterator s) const;
void priv_clear_buckets(const bucket_ptr buckets_ptr, const std::size_t bucket_cnt);
std::size_t priv_stored_or_compute_hash(const value_type & v, unspecified) const;
iterator end() noexcept;
const_iterator end() const noexcept;
const_iterator cend() const noexcept;
iterator build_iterator(siterator s, bucket_ptr p);
iterator build_iterator(siterator s, bucket_ptr p, unspecified);
iterator build_iterator(siterator s, bucket_ptr, unspecified);linear buckets
const_iterator build_const_iterator(siterator s, bucket_ptr p) const;
const_iterator build_const_iterator(siterator s, bucket_ptr p, unspecified) const;
const_iterator build_const_iterator(siterator s, bucket_ptr, unspecified) const;linear buckets
bucket_plus_vtraits
public static functionsstatic siterator priv_bucket_lbegin(bucket_type & b);
static siterator priv_bucket_lbbegin(bucket_type & b);
static siterator priv_bucket_lend(bucket_type & b);
static std::size_t priv_bucket_size(const bucket_type & b);
static bool priv_bucket_empty(const bucket_type & b);
template<typename NodeDisposer> static std::size_t priv_erase_from_single_bucket(bucket_type & b, siterator sbefore_first, siterator slast, NodeDisposer node_disposer, unspecified);
template<typename NodeDisposer> static std::size_t priv_erase_from_single_bucket(bucket_type &, siterator sbefore_first, siterator slast, NodeDisposer node_disposer, unspecified);
template<typename NodeDisposer> static void priv_erase_node(bucket_type & b, siterator i, NodeDisposer node_disposer, unspecified);
template<typename NodeDisposer> static void priv_erase_node(bucket_type & b, siterator i, NodeDisposer node_disposer, unspecified);optimize multikey
static siterator priv_get_last(bucket_type & b, unspecified);
static siterator priv_get_last(bucket_type & b, unspecified);
template<typename NodeDisposer> static std::size_t priv_erase_whole_bucket(bucket_type & b, NodeDisposer node_disposer);
static siterator priv_get_previous(bucket_type & b, siterator i, unspecified);
static siterator priv_get_previous(bucket_type & b, siterator i, unspecified);
static bucket_ptr to_ptr(bucket_type & b);
static siterator sit_bbegin(bucket_type & b);
static siterator sit_begin(bucket_type & b);
static siterator sit_end(bucket_type & b);
static std::size_t priv_stored_hash(siterator s, unspecified);
static std::size_t priv_stored_hash(siterator, unspecified);
static void priv_init_buckets(const bucket_ptr buckets_ptr, const std::size_t bucket_cnt);