...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::interprocess::iunordered_set_index
// In header: <boost/interprocess/indexes/iunordered_set_index.hpp> template<typename MapConfig> class iunordered_set_index : private iunordered_set_index_aux::allocator_holder, private iunordered_set_index_aux::index_t { public: // types typedef index_type::iterator iterator; typedef index_type::const_iterator const_iterator; typedef index_type::insert_commit_data insert_commit_data; typedef index_type::value_type value_type; typedef index_type::bucket_ptr bucket_ptr; typedef index_type::bucket_type bucket_type; typedef index_type::bucket_traits bucket_traits; typedef index_type::size_type size_type; typedef index_type::difference_type difference_type; typedef value_type index_data_t; // public member functions iunordered_set_index(segment_manager_base *); ~iunordered_set_index(); void reserve(size_type); void shrink_to_fit(); iterator find(const compare_key_type &); const_iterator find(const compare_key_type &) const; std::pair< iterator, bool > insert_check(const compare_key_type &, insert_commit_data &); iterator insert_commit(const compare_key_type &, void *, index_data_t &, insert_commit_data &); };
Index type based in boost::intrusive::set. Just derives from boost::intrusive::set and defines the interface needed by managed memory segments
iunordered_set_index
public member functionsiunordered_set_index(segment_manager_base * mngr);
Constructor. Takes a pointer to the segment manager. Can throw
~iunordered_set_index();
void reserve(size_type new_n);
This reserves memory to optimize the insertion of n elements in the index
void shrink_to_fit();
This tries to free unused memory previously allocated.
iterator find(const compare_key_type & key);
const_iterator find(const compare_key_type & key) const;
std::pair< iterator, bool > insert_check(const compare_key_type & key, insert_commit_data & commit_data);
iterator insert_commit(const compare_key_type &, void *, index_data_t & val, insert_commit_data & commit_data);