1 # ifndef TPL_NODEPOOL_H
2 # define TPL_NODEPOOL_H
4 # include <tpl_arrayStack.H>
27 Node_Pool(
size_t __n = 100) : node_pool(__n), n(__n) { }
32 return node_pool.
is_empty() ?
new Node : node_pool.
pop();
48 Node *
allocate(
const typename Node::key_type & key)
53 Node *
allocate(
typename Node::key_type && key)
55 return new (
allocate()) Node (std::move(key));
78 if (node_pool.
size() == n)
87 delete node_pool.
pop();
91 # endif // TPL_NODEPOOL_H
bool is_empty() const
Retorna true si la pila está vacía.
Definition: tpl_arrayStack.H:413
Definition: tpl_nodePool.H:19
T pop()
Definition: tpl_arrayStack.H:353
T & push(const T &data)
Definition: tpl_arrayStack.H:312
const size_t & size() const
Retorna el número de elementos que contiene la pila.
Definition: tpl_arrayStack.H:419
void deallocate(Node *p)
Definition: tpl_nodePool.H:76
Node * allocate(const typename Node::key_type &key)
Definition: tpl_nodePool.H:48
Node * allocate()
Definition: tpl_nodePool.H:30