node* allocator::move(node* root, unsigned int prunning) { node* r = allocate_unsafe(1); copy(root, r, prunning); free_pointer = node_arena; node* res = allocate_unsafe(1); copy(r, res); return res; }
T * construct_unsafe (ArgumentType const & arg) { T * node = allocate_unsafe(); if (node) new(node) T(arg); return node; }
T * construct_unsafe (void) { T * node = allocate_unsafe(); if (node) new(node) T(); return node; }
void allocator::copy(node* n1, node* n2, unsigned int prunning) { if (n1->get_statistics().count < prunning) return; n2->set_statistics(n1->get_statistics()); unsigned int nb_children = n1->get_number_of_children(); n2->set_number_of_children(nb_children); if (nb_children == 0) return; n2->set_children(allocate_unsafe(nb_children)); node* children1 = n1->get_children(); node* children2 = n2->get_children(); for (unsigned int i = 0; i < nb_children; ++i) { copy(children1 + i, children2 + i, prunning); } }