![]() |
Home | Libraries | People | FAQ | More |
boost::container::allocator
// In header: <boost/container/allocator.hpp> template<typename T, Version = , AllocationDisableMask = > class allocator { public: // types typedef ; typedef ; typedef ; typedef ; typedef ; typedef ; typedef ; typedef ; // member classes/structs/unions template<typename T2> struct rebind { // types typedef allocator< ; }; // public member functions () ; (allocator &) ; template<typename T2> (allocator< ) ; (, = ); (, ) ; () ; (, , , ); () ; (); (, ); () ; () ; (, , ); (, , ); () ; // friend functions (, ) ; (allocator &, allocator &) ; (allocator &, allocator &) ; // private member functions (, , , ); };
This class is an extended STL-compatible that offers advanced allocation mechanism (in-place expansion, shrinking, burst-allocation...)
This allocator is a wrapper around a modified DLmalloc. 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.
allocator
public member functions() ;
Default constructor Never throws
(allocator &) ;
Constructor from other allocator. Never throws
template<typename T2> (allocator< ) ;
Constructor from related allocator. Never throws
( count, hint = );
Allocates memory for an array of count elements. Throws 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()
( ptr, ) ;
Deallocates previously allocated memory. Never throws
() ;
Returns the maximum number of elements that could be allocated. Never throws
( command, limit_size, prefer_in_recvd_out_size, reuse);
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
( p) ;
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
();
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
( num_elements, chain);
Allocates many elements of size == 1. Elements must be individually deallocated with deallocate_one() This function is available only with Version == 2
( p) ;
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.
( chain) ;
Deallocates memory allocated with allocate_one() or allocate_individual(). This function is available only with Version == 2
( elem_size, n_elements, chain);
Allocates many elements of size elem_size. Elements must be individually deallocated with deallocate() This function is available only with Version == 2
( elem_sizes, n_elements, 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
( chain) ;
Deallocates several elements allocated by allocate_many(), allocate(), or allocation_command(). This function is available only with Version == 2
allocator
friend functions(, ) ;
Swaps two allocators, does nothing because this allocator is stateless
(allocator &, allocator &) ;
An allocator always compares to true, as memory allocated with one instance can be deallocated by another instance
(allocator &, allocator &) ;
An allocator always compares to false, as memory allocated with one instance can be deallocated by another instance