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

Click here to view the latest version of this page.
PrevUpHomeNext

Class template basic_managed_heap_memory

boost::interprocess::basic_managed_heap_memory

Synopsis

// In header: <boost/interprocess/managed_heap_memory.hpp>

template<typename CharType, typename AllocationAlgorithm, 
         template< class IndexConfig > class IndexType> 
class basic_managed_heap_memory {
public:
  // types
  typedef base_t::size_type size_type;

  // construct/copy/destruct
  basic_managed_heap_memory();
  basic_managed_heap_memory(size_type);
  basic_managed_heap_memory(basic_managed_heap_memory &&);
  basic_managed_heap_memory& operator=(basic_managed_heap_memory &&);
  ~basic_managed_heap_memory();

  // public member functions
  bool grow(size_type);
  void swap(basic_managed_heap_memory &);
};

Description

A basic heap memory named object creation class. Initializes the heap memory segment. Inherits all basic functionality from basic_managed_memory_impl<CharType, AllocationAlgorithm, IndexType>

basic_managed_heap_memory public construct/copy/destruct

  1. basic_managed_heap_memory();

    Default constructor. Does nothing. Useful in combination with move semantics

  2. basic_managed_heap_memory(size_type size);

    Creates heap memory and initializes the segment manager. This can throw.

  3. basic_managed_heap_memory(basic_managed_heap_memory && moved);
    Moves the ownership of "moved"'s managed memory to *this. Does not throw.
  4. basic_managed_heap_memory& operator=(basic_managed_heap_memory && moved);
    Moves the ownership of "moved"'s managed memory to *this. Does not throw.
  5. ~basic_managed_heap_memory();

    Destructor. Liberates the heap memory holding the managed data. Never throws.

basic_managed_heap_memory public member functions

  1. bool grow(size_type extra_bytes);

    Tries to resize internal heap memory so that we have room for more objects. WARNING: If memory is reallocated, all the objects will be binary-copied to the new buffer. To be able to use this function, all pointers constructed in this buffer must be offset pointers. Otherwise, the result is undefined. Returns true if the growth has been successful, so you will have some extra bytes to allocate new objects. If returns false, the heap allocation has failed.

  2. void swap(basic_managed_heap_memory & other);

    Swaps the ownership of the managed heap memories managed by *this and other. Never throws.


PrevUpHomeNext