Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize > Singleton Reference

A C++ Standard Library conforming allocator, based on an underlying pool. More...

#include <poolfwd.hpp>

Classes

struct  rebind
 Nested class rebind allows for transformation from pool_allocator<T> to pool_allocator<U>. More...
 

Public Types

typedef T value_type
 value_type of template parameter T. More...
 
typedef UserAllocator user_allocator
 allocator that defines the method that the underlying Pool will use to allocate memory from the system. More...
 
typedef Mutex mutex
 typedef mutex publishes the value of the template parameter Mutex. More...
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef pool< UserAllocator >
::size_type 
size_type
 
typedef pool< UserAllocator >
::difference_type 
difference_type
 

Public Member Functions

 BOOST_STATIC_CONSTANT (unsigned, next_size=NextSize)
 next_size publishes the values of the template parameter NextSize. More...
 
 pool_allocator ()
 
template<typename U >
 pool_allocator (const pool_allocator< U, UserAllocator, Mutex, NextSize, MaxSize > &)
 
bool operator== (const pool_allocator &) const
 
bool operator!= (const pool_allocator &) const
 

Static Public Member Functions

static pointer address (reference r)
 
static const_pointer address (const_reference s)
 
static size_type max_size ()
 
static void construct (const pointer ptr, const value_type &t)
 
static void destroy (const pointer ptr)
 
static pointer allocate (const size_type n)
 
static pointer allocate (const size_type n, const void *const)
 
static void deallocate (const pointer ptr, const size_type n)
 

Detailed Description

template<typename T, typename UserAllocator, typename Mutex, unsigned NextSize, unsigned MaxSize>
singleton boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >

A C++ Standard Library conforming allocator, based on an underlying pool.

Template parameters for pool_allocator are defined as follows:

T Type of object to allocate/deallocate.

UserAllocator. Defines the method that the underlying Pool will use to allocate memory from the system. See User Allocators for details.

Mutex Allows the user to determine the type of synchronization to be used on the underlying singleton_pool.

NextSize The value of this parameter is passed to the underlying singleton_pool when it is created.

MaxSize Limit on the maximum size used.

Attention
The underlying singleton_pool used by the this allocator constructs a pool instance that is never freed. This means that memory allocated by the allocator can be still used after main() has completed, but may mean that some memory checking programs will complain about leaks.

Member Typedef Documentation

template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
typedef const value_type* boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::const_pointer
template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
typedef const value_type& boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::const_reference
template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
typedef pool<UserAllocator>::difference_type boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::difference_type
template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
typedef Mutex boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::mutex

typedef mutex publishes the value of the template parameter Mutex.

template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
typedef value_type* boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::pointer
template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
typedef value_type& boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::reference
template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
typedef pool<UserAllocator>::size_type boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::size_type
template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
typedef UserAllocator boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::user_allocator

allocator that defines the method that the underlying Pool will use to allocate memory from the system.

template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
typedef T boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::value_type

value_type of template parameter T.

Constructor & Destructor Documentation

template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::pool_allocator ( )
inline

Results in default construction of the underlying singleton_pool IFF an instance of this allocator is constructed during global initialization ( required to ensure construction of 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) .

References T.

template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
template<typename U >
boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::pool_allocator ( const pool_allocator< U, UserAllocator, Mutex, NextSize, MaxSize > &  )
inline

Results in the default construction of the underlying singleton_pool, this is required to ensure construction of 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 .

References T.

Member Function Documentation

template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
static pointer boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::address ( reference  r)
inlinestatic
template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
static const_pointer boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::address ( const_reference  s)
inlinestatic

References boost::asio::s.

template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
static pointer boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::allocate ( const size_type  n)
inlinestatic
template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
static pointer boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::allocate ( const size_type  n,
const void *  const 
)
inlinestatic

allocate n bytes

Parameters
nbytes to allocate.
unused.

References boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::allocate().

template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::BOOST_STATIC_CONSTANT ( unsigned  ,
next_size  = NextSize 
)

next_size publishes the values of the template parameter NextSize.

template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
static void boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::construct ( const pointer  ptr,
const value_type t 
)
inlinestatic

References boost::python::ptr(), and T.

template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
static void boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::deallocate ( const pointer  ptr,
const size_type  n 
)
inlinestatic

Deallocate n bytes from ptr

Parameters
ptrlocation to deallocate from.
nnumber of bytes to deallocate.

References T.

template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
static void boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::destroy ( const pointer  ptr)
inlinestatic

References boost::detail::void.

template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
static size_type boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::max_size ( void  )
inlinestatic
template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
bool boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::operator!= ( const pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize > &  ) const
inline
template<typename T , typename UserAllocator , typename Mutex , unsigned NextSize, unsigned MaxSize>
bool boost::pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize >::operator== ( const pool_allocator< T, UserAllocator, Mutex, NextSize, MaxSize > &  ) const
inline

The documentation for this singleton was generated from the following file: