| Home | Libraries | People | FAQ | More

## Class template iunordered_set_index

boost::interprocess::iunordered_set_index

## Synopsis

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

    template<typename MapConfig>
    class iunordered_set_index : private boost::interprocess::iunordered_set_index_aux< MapConfig >::allocator_holder
    {
    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_aux::segment_manager_base segment_manager_base;  // @ private:

      enum @4 { InitBufferSize =  64 };

      // construct/copy/destruct
      iunordered_set_index(segment_manager_base *);
      ~iunordered_set_index();

      // public static functions
      static bucket_ptr create_buckets(allocator_type &, std::size_t);
      static std::size_t
      shrink_buckets(bucket_ptr, std::size_t, allocator_type &, std::size_t);
      static bucket_ptr
      expand_or_create_buckets(bucket_ptr, const std::size_t, allocator_type &,
                               const std::size_t);
      static void destroy_buckets(allocator_type &, bucket_ptr, std::size_t);

      // public member functions
      iunordered_set_index< MapConfig > * get_this_pointer();
      void reserve(std::size_t);
      void shrink_to_fit();
      iterator find(const intrusive_compare_key_type &);
      const_iterator find(const intrusive_compare_key_type &) const;
      std::pair< iterator, bool >
      insert_check(const intrusive_compare_key_type &, insert_commit_data &);
      iterator insert_commit(value_type &, insert_commit_data &);
    };

## Description

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 construct/copy/destruct

1.     iunordered_set_index(segment_manager_base * mngr);

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

2.     ~iunordered_set_index();

### `iunordered_set_index` public static functions

1.     static bucket_ptr create_buckets(allocator_type & alloc, std::size_t num);

2.     static std::size_t
       shrink_buckets(bucket_ptr buckets, std::size_t old_size,
                      allocator_type & alloc, std::size_t new_size);

3.     static bucket_ptr
       expand_or_create_buckets(bucket_ptr old_buckets, const std::size_t old_num,
                                allocator_type & alloc, const std::size_t new_num);

4.     static void destroy_buckets(allocator_type & alloc, bucket_ptr buckets,
                                   std::size_t num);

### `iunordered_set_index` public member functions

1.     iunordered_set_index< MapConfig > * get_this_pointer();

2.     void reserve(std::size_t new_n);

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

3.     void shrink_to_fit();

   This tries to free unused memory previously allocated.

4.     iterator find(const intrusive_compare_key_type & key);

5.     const_iterator find(const intrusive_compare_key_type & key) const;

6.     std::pair< iterator, bool >
       insert_check(const intrusive_compare_key_type & key,
                    insert_commit_data & commit_data);

7.     iterator insert_commit(value_type & val, insert_commit_data & commit_data);