Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::container::allocator< T, Version, AllocationDisableMask > Singleton Reference

If Version is 1, the allocator is a STL conforming allocator. More...

#include <container_fwd.hpp>

Classes

struct  rebind
 Obtains an allocator that allocates objects of type T2. More...
 

Public Types

typedef T value_type
 
typedef Tpointer
 
typedef const Tconst_pointer
 
typedef Treference
 
typedef const Tconst_reference
 
typedef std::size_t size_type
 
typedef std::ptrdiff_t difference_type
 
typedef
boost::container::container_detail::version_type
< self_t, Version > 
version
 
typedef
boost::container::container_detail::basic_multiallocation_chain
< void * > 
void_multiallocation_chain
 
typedef
boost::container::container_detail::transform_multiallocation_chain
< void_multiallocation_chain,
T
multiallocation_chain
 

Public Member Functions

 allocator () BOOST_CONTAINER_NOEXCEPT
 Default constructor Never throws. More...
 
 allocator (const allocator &) BOOST_CONTAINER_NOEXCEPT
 Constructor from other allocator. More...
 
template<class T2 >
 allocator (const allocator< T2, Version, AllocationDisableMask > &) BOOST_CONTAINER_NOEXCEPT
 Constructor from related allocator. More...
 
pointer allocate (size_type count, const void *hint=0)
 Allocates memory for an array of count elements. More...
 
void deallocate (pointer ptr, size_type) BOOST_CONTAINER_NOEXCEPT
 Deallocates previously allocated memory. More...
 
size_type max_size () const BOOST_CONTAINER_NOEXCEPT
 Returns the maximum number of elements that could be allocated. More...
 
std::pair< pointer, bool > allocation_command (allocation_type command, size_type limit_size, size_type preferred_size, size_type &received_size, pointer reuse=pointer())
 An advanced function that offers in-place expansion shrink to fit and new allocation capabilities. More...
 
size_type size (pointer p) const BOOST_CONTAINER_NOEXCEPT
 Returns maximum the number of objects the previously allocated memory pointed by p can hold. More...
 
pointer allocate_one ()
 Allocates just one object. More...
 
void allocate_individual (std::size_t num_elements, multiallocation_chain &chain)
 Allocates many elements of size == 1. More...
 
void deallocate_one (pointer p) BOOST_CONTAINER_NOEXCEPT
 Deallocates memory previously allocated with allocate_one(). More...
 
void deallocate_individual (multiallocation_chain &chain) BOOST_CONTAINER_NOEXCEPT
 Deallocates memory allocated with allocate_one() or allocate_individual(). More...
 
void allocate_many (size_type elem_size, std::size_t n_elements, multiallocation_chain &chain)
 Allocates many elements of size elem_size. More...
 
void allocate_many (const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain)
 Allocates n_elements elements, each one of size elem_sizes[i] Elements must be individually deallocated with deallocate() This function is available only with Version == 2. More...
 
void deallocate_many (multiallocation_chain &chain) BOOST_CONTAINER_NOEXCEPT
 Deallocates several elements allocated by allocate_many(), allocate(), or allocation_command(). More...
 

Friends

void swap (self_t &, self_t &) BOOST_CONTAINER_NOEXCEPT
 Swaps two allocators, does nothing because this allocator is stateless. More...
 
bool operator== (const allocator &, const allocator &) BOOST_CONTAINER_NOEXCEPT
 An allocator always compares to true, as memory allocated with one instance can be deallocated by another instance. More...
 
bool operator!= (const allocator &, const allocator &) BOOST_CONTAINER_NOEXCEPT
 An allocator always compares to false, as memory allocated with one instance can be deallocated by another instance. More...
 

Detailed Description

template<class T, unsigned Version, unsigned int AllocationDisableMask>
singleton boost::container::allocator< T, Version, AllocationDisableMask >

If Version is 1, the allocator is a STL conforming allocator.

If Version is 2, the allocator offers advanced expand in place and burst allocation capabilities. AllocationDisableMask works only if Version is 2 and it can be an inclusive OR of allocation types the user wants to disable.

Member Typedef Documentation

template<class T , unsigned Version, unsigned int AllocationDisableMask>
typedef const T* boost::container::allocator< T, Version, AllocationDisableMask >::const_pointer
template<class T , unsigned Version, unsigned int AllocationDisableMask>
typedef const T& boost::container::allocator< T, Version, AllocationDisableMask >::const_reference
template<class T , unsigned Version, unsigned int AllocationDisableMask>
typedef std::ptrdiff_t boost::container::allocator< T, Version, AllocationDisableMask >::difference_type
template<class T , unsigned Version, unsigned int AllocationDisableMask>
typedef boost::container::container_detail:: transform_multiallocation_chain<void_multiallocation_chain, T> boost::container::allocator< T, Version, AllocationDisableMask >::multiallocation_chain
template<class T , unsigned Version, unsigned int AllocationDisableMask>
typedef T* boost::container::allocator< T, Version, AllocationDisableMask >::pointer
template<class T , unsigned Version, unsigned int AllocationDisableMask>
typedef T& boost::container::allocator< T, Version, AllocationDisableMask >::reference
template<class T , unsigned Version, unsigned int AllocationDisableMask>
typedef std::size_t boost::container::allocator< T, Version, AllocationDisableMask >::size_type
template<class T , unsigned Version, unsigned int AllocationDisableMask>
typedef T boost::container::allocator< T, Version, AllocationDisableMask >::value_type
template<class T , unsigned Version, unsigned int AllocationDisableMask>
typedef boost::container::container_detail:: version_type<self_t, Version> boost::container::allocator< T, Version, AllocationDisableMask >::version
template<class T , unsigned Version, unsigned int AllocationDisableMask>
typedef boost::container::container_detail:: basic_multiallocation_chain<void*> boost::container::allocator< T, Version, AllocationDisableMask >::void_multiallocation_chain

Constructor & Destructor Documentation

template<class T , unsigned Version, unsigned int AllocationDisableMask>
boost::container::allocator< T, Version, AllocationDisableMask >::allocator ( )
inline

Default constructor Never throws.

template<class T , unsigned Version, unsigned int AllocationDisableMask>
boost::container::allocator< T, Version, AllocationDisableMask >::allocator ( const allocator< T, Version, AllocationDisableMask > &  )
inline

Constructor from other allocator.

Never throws

template<class T , unsigned Version, unsigned int AllocationDisableMask>
template<class T2 >
boost::container::allocator< T, Version, AllocationDisableMask >::allocator ( const allocator< T2, Version, AllocationDisableMask > &  )
inline

Constructor from related allocator.

Never throws

Member Function Documentation

template<class T , unsigned Version, unsigned int AllocationDisableMask>
pointer boost::container::allocator< T, Version, AllocationDisableMask >::allocate ( size_type  count,
const void *  hint = 0 
)
inline

Allocates memory for an array of count elements.

Throws std::bad_alloc if there is no enough memory If Version is 2, this allocated memory can only be deallocated with deallocate() or (for Version == 2) deallocate_many()

References boost::container::allocator< T, Version, AllocationDisableMask >::max_size(), T, boost::container::throw_bad_alloc(), and boost::detail::void.

Referenced by boost::container::allocator< T, Version, AllocationDisableMask >::allocate_one().

template<class T , unsigned Version, unsigned int AllocationDisableMask>
void boost::container::allocator< T, Version, AllocationDisableMask >::allocate_individual ( std::size_t  num_elements,
multiallocation_chain chain 
)
inline

Allocates many elements of size == 1.

Elements must be individually deallocated with deallocate_one() This function is available only with Version == 2

References boost::container::allocator< T, Version, AllocationDisableMask >::allocate_many().

template<class T , unsigned Version, unsigned int AllocationDisableMask>
void boost::container::allocator< T, Version, AllocationDisableMask >::allocate_many ( size_type  elem_size,
std::size_t  n_elements,
multiallocation_chain chain 
)
inline

Allocates many elements of size elem_size.

Elements must be individually deallocated with deallocate() This function is available only with Version == 2

References T, and boost::container::throw_bad_alloc().

Referenced by boost::container::allocator< T, Version, AllocationDisableMask >::allocate_individual().

template<class T , unsigned Version, unsigned int AllocationDisableMask>
void boost::container::allocator< T, Version, AllocationDisableMask >::allocate_many ( const size_type elem_sizes,
size_type  n_elements,
multiallocation_chain chain 
)
inline

Allocates n_elements elements, each one of size elem_sizes[i] Elements must be individually deallocated with deallocate() This function is available only with Version == 2.

References T, and boost::container::throw_bad_alloc().

template<class T , unsigned Version, unsigned int AllocationDisableMask>
pointer boost::container::allocator< T, Version, AllocationDisableMask >::allocate_one ( )
inline

Allocates just one object.

Memory allocated with this function must be deallocated only with deallocate_one(). Throws bad_alloc if there is no enough memory This function is available only with Version == 2

References boost::container::allocator< T, Version, AllocationDisableMask >::allocate().

template<class T , unsigned Version, unsigned int AllocationDisableMask>
std::pair<pointer, bool> boost::container::allocator< T, Version, AllocationDisableMask >::allocation_command ( allocation_type  command,
size_type  limit_size,
size_type  preferred_size,
size_type received_size,
pointer  reuse = pointer() 
)
inline

An advanced function that offers in-place expansion shrink to fit and new allocation capabilities.

Memory allocated with this function can only be deallocated with deallocate() or deallocate_many(). This function is available only with Version == 2

References boost::container::throw_bad_alloc().

template<class T , unsigned Version, unsigned int AllocationDisableMask>
void boost::container::allocator< T, Version, AllocationDisableMask >::deallocate ( pointer  ptr,
size_type   
)
inline

Deallocates previously allocated memory.

Never throws

Referenced by boost::container::allocator< T, Version, AllocationDisableMask >::deallocate_one().

template<class T , unsigned Version, unsigned int AllocationDisableMask>
void boost::container::allocator< T, Version, AllocationDisableMask >::deallocate_individual ( multiallocation_chain chain)
inline

Deallocates memory allocated with allocate_one() or allocate_individual().

This function is available only with Version == 2

References boost::container::allocator< T, Version, AllocationDisableMask >::deallocate_many().

template<class T , unsigned Version, unsigned int AllocationDisableMask>
void boost::container::allocator< T, Version, AllocationDisableMask >::deallocate_many ( multiallocation_chain chain)
inline
template<class T , unsigned Version, unsigned int AllocationDisableMask>
void boost::container::allocator< T, Version, AllocationDisableMask >::deallocate_one ( pointer  p)
inline

Deallocates memory previously allocated with allocate_one().

You should never use deallocate_one to deallocate memory allocated with other functions different from allocate_one() or allocate_individual.

References boost::container::allocator< T, Version, AllocationDisableMask >::deallocate(), and boost::multiprecision::backends::p.

template<class T , unsigned Version, unsigned int AllocationDisableMask>
size_type boost::container::allocator< T, Version, AllocationDisableMask >::max_size ( ) const
inline

Returns the maximum number of elements that could be allocated.

Never throws

References T.

Referenced by boost::container::allocator< T, Version, AllocationDisableMask >::allocate().

template<class T , unsigned Version, unsigned int AllocationDisableMask>
size_type boost::container::allocator< T, Version, AllocationDisableMask >::size ( pointer  p) const
inline

Returns maximum the number of objects the previously allocated memory pointed by p can hold.

Memory must not have been allocated with allocate_one or allocate_individual. This function is available only with Version == 2

References boost::multiprecision::backends::p.

Referenced by boost::container::allocator< T, Version, AllocationDisableMask >::deallocate_many().

Friends And Related Function Documentation

template<class T , unsigned Version, unsigned int AllocationDisableMask>
bool operator!= ( const allocator< T, Version, AllocationDisableMask > &  ,
const allocator< T, Version, AllocationDisableMask > &   
)
friend

An allocator always compares to false, as memory allocated with one instance can be deallocated by another instance.

template<class T , unsigned Version, unsigned int AllocationDisableMask>
bool operator== ( const allocator< T, Version, AllocationDisableMask > &  ,
const allocator< T, Version, AllocationDisableMask > &   
)
friend

An allocator always compares to true, as memory allocated with one instance can be deallocated by another instance.

template<class T , unsigned Version, unsigned int AllocationDisableMask>
void swap ( self_t ,
self_t  
)
friend

Swaps two allocators, does nothing because this allocator is stateless.


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