![]() |
Home | Libraries | People | FAQ | More |
boost::container::node_allocator
// In header: <boost/container/node_allocator.hpp> template<typename T, NodesPerBlock = > class node_allocator { public: // types typedef ; typedef node_allocator< ; typedef ; typedef ; typedef ; typedef :: ; typedef :: ; typedef ; typedef ; typedef self_t,( ; typedef ; typedef ; // member classes/structs/unions template<typename T, NodesPerBlock = > struct rebind { // types typedef node_allocator< ; }; // construct/copy/destruct (); (node_allocator &); template<typename T2> (node_allocator< ); template<typename T2, N2> node_allocator & (node_allocator< ); ~(); // public member functions ((); () ; (, = ); (, ); (, , , ); () ; (); (, ); (); (); (, , ); (, , ); (); // private member functions (, , , ); // public static functions (); // friend functions (self_t &, self_t &); (node_allocator &, node_allocator &); (node_allocator &, node_allocator &); // public data members static nodes_per_block; };
An STL node allocator that uses a modified DlMalloc as memory source.
This node allocator shares a segregated storage between all instances of node_allocator with equal sizeof(T).
NodesPerBlock is the number of nodes allocated at once when the allocator runs out of nodes
node_allocator
public
construct/copy/destruct();Default constructor.
(node_allocator &);Copy constructor from other
node_allocator
. template<typename T2> (node_allocator< );Copy constructor from related
node_allocator
. template<typename T2, N2> node_allocator & (node_allocator< );Not assignable from related
node_allocator
. ~();Destructor.
node_allocator
public member functions(();
() ;
Returns the number of elements that could be allocated. Never throws
( count, = );
Allocate memory for an array of count elements. Throws bad_alloc
if there is no enough memory
( ptr, count);
Deallocate allocated memory. Never throws
( command, limit_size, prefer_in_recvd_out_size, reuse);
( p) ;
Returns maximum the number of objects the previously allocated memory pointed by p can hold.
();
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
( num_elements, chain);
Allocates many elements of size == 1. Elements must be individually deallocated with deallocate_one()
( 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(). Never throws
( chain);
( elem_size, n_elements, chain);
Allocates many elements of size elem_size. Elements must be individually deallocated with deallocate()
( elem_sizes, n_elements, chain);
Allocates n_elements elements, each one of size elem_sizes[i] Elements must be individually deallocated with deallocate()
( chain);
node_allocator
friend functions(self_t &, self_t &);
Swaps allocators. Does not throw. If each allocator is placed in a different memory segment, the result is undefined.
(node_allocator &, node_allocator &);
An allocator always compares to true, as memory allocated with one instance can be deallocated by another instance
(node_allocator &, node_allocator &);
An allocator always compares to false, as memory allocated with one instance can be deallocated by another instance