Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template fast_pool_allocator<void, UserAllocator, Mutex, NextSize, MaxSize>

boost::fast_pool_allocator<void, UserAllocator, Mutex, NextSize, MaxSize> — Specialization of fast_pool_allocator<void>.

Synopsis

// In header: <boost/pool/pool_alloc.hpp>

template<typename UserAllocator, typename Mutex, unsigned NextSize, 
         unsigned MaxSize> 
class fast_pool_allocator<void, UserAllocator, Mutex, NextSize, MaxSize> {
public:
  // types
  typedef void *                                 pointer;        
  typedef const void *                           const_pointer;  
  typedef void                                   value_type;     
  typedef UserAllocator                          user_allocator; 
  typedef Mutex                                  mutex;          
  typedef value_type &                           reference;      
  typedef const value_type &                     const_reference;
  typedef pool< UserAllocator >::size_type       size_type;      
  typedef pool< UserAllocator >::difference_type difference_type;

  // member classes/structs/unions

  // Nested class rebind allows for transformation from fast_pool_allocator<T> to fast_pool_allocator<underline>. </underline>
  template<typename U> 
  struct rebind {
    // types
    typedef fast_pool_allocator< U, UserAllocator, Mutex, NextSize, MaxSize > other;
  };

  // public member functions
  fast_pool_allocator();
  void construct(const pointer, const value_type &);
  void destroy(const pointer);
  bool operator==(const fast_pool_allocator &) const;
  bool operator!=(const fast_pool_allocator &) const;

  // public static functions
  static pointer address(reference);
  static size_type max_size();
  static pointer allocate(const size_type);
  static void deallocate(const pointer, const size_type);

  // public data members
  static const unsigned next_size;
};

Description

Specialization of fast_pool_allocator<void> required to make the allocator standard-conforming.

fast_pool_allocator public member functions

  1. fast_pool_allocator();

    Ensures construction of the underlying singleton_pool IFF an instance of this allocator is constructed during global initialization. See ticket #2359 for a complete explanation at http://svn.boost.org/trac/boost/ticket/2359 .

  2. void construct(const pointer ptr, const value_type & t);
  3. void destroy(const pointer ptr);

    Destroy ptr using destructor.

  4. bool operator==(const fast_pool_allocator &) const;
  5. bool operator!=(const fast_pool_allocator &) const;

fast_pool_allocator public static functions

  1. static pointer address(reference r);
  2. static size_type max_size();
  3. static pointer allocate(const size_type n);
  4. static void deallocate(const pointer ptr, const size_type n);

    Deallocate memory.


PrevUpHomeNext