Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Class template map_index

boost::interprocess::map_index

Synopsis

// In header: <boost/interprocess/indexes/map_index.hpp>

template<typename MapConfig> 
class map_index {
public:
  // types
  typedef base_type::iterator         iterator;          
  typedef base_type::const_iterator   const_iterator;    
  typedef base_type::value_type       value_type;        
  typedef MapConfig::compare_key_type compare_key_type;  
  typedef iterator                    insert_commit_data;
  typedef iterator                    index_data_t;      

  // public member functions
  map_index(segment_manager_base *);
  void reserve(typename segment_manager_base::size_type);
  void shrink_to_fit();
  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 &);
  iterator find(const compare_key_type &);
};

Description

Index type based in boost::interprocess::map. Just derives from boost::interprocess::map and defines the interface needed by managed memory segments

map_index public member functions

  1. map_index(segment_manager_base * segment_mngr);

    Constructor. Takes a pointer to the segment manager. Can throw

  2. void reserve(typename segment_manager_base::size_type);

    This reserves memory to optimize the insertion of n elements in the index

  3. void shrink_to_fit();

    This tries to free previously allocate unused memory.

  4. std::pair< iterator, bool > 
    insert_check(const compare_key_type & key, insert_commit_data &);
  5. iterator insert_commit(const compare_key_type & k, void * context, 
                           index_data_t & index_data, insert_commit_data &);
  6. iterator find(const compare_key_type & k);

PrevUpHomeNext