<
classT1,
classT2>
62 new((
void*) p) T1(
val);
88 template<
classT,
classtree_node_allocator = std::allocator<tree_node_<T> > >
107 #ifdef __SGI_STL_PORT 108 class iterator_base:
publicstlport::bidirectional_iterator<T, ptrdiff_t> {
124 T* operator->()
const;
128 voidskip_children();
129 unsigned intnumber_of_children()
const;
192 voidset_first_parent_();
193 voidfind_leftmost_parent_();
228 template<
typenameiter> iter parent(iter)
const;
234 template<
typenameiter> iter erase(iter);
239 template<
typenameiter> iter append_child(iter position);
240 template<
typenameiter> iter append_child(iter position,
const T& x);
242 template<
typenameiter> iter append_child(iter position, iter other_position);
248 template<
typenameiter> iter insert(iter position,
const T& x);
253 template<
typenameiter> iter insert_subtree(iter position,
const iterator_base& subtree);
255 template<
typenameiter> iter insert_after(iter position,
const T& x);
258 template<
typenameiter> iter replace(iter position,
const T& x);
260 template<
typenameiter> iter replace(iter position,
const iterator_base& from);
266 template<
typenameiter> iter
flatten(iter position);
270 template<
typenameiter> iter reparent(iter position, iter from);
274 template<
typenameiter> iter move_before(iter target, iter
source);
279 boolduplicate_leaves=
false);
282 template<
classStrictWeakOrdering>
285 template<
typenameiter>
286 boolequal(
constiter& one,
constiter& two,
constiter& three)
const;
287 template<
typenameiter,
classBinaryPredicate>
288 boolequal(
constiter& one,
constiter& two,
constiter& three, BinaryPredicate)
const;
289 template<
typenameiter>
290 boolequal_subtree(
constiter& one,
constiter& two)
const;
291 template<
typenameiter,
classBinaryPredicate>
292 boolequal_subtree(
constiter& one,
constiter& two, BinaryPredicate)
const;
305 bool empty()
const;
309 unsigned intnumber_of_children(
const iterator_base&)
const;
311 unsigned intnumber_of_siblings(
const iterator_base&)
const;
329 returnone.node < two.
node;
344 iteratorattachNode, oldParent, z, zz;
346 intnTopLevelNodes = number_of_siblings(begin());
349 newTree= subtree(newRoot, next_sibling(newRoot));
351oldParent = parent(newRoot);
356z = parent(oldParent);
357attachNode =
newTree.reparent(attachNode, oldParent, next_sibling(oldParent));
365 if(nTopLevelNodes > 1) {
366 if(nTopLevelNodes > 2) {
370 while(z.
is_valid() && z != end()) {
371zz = next_sibling(z);
372 newTree.reparent(attachNode, z, zz);
380nChildren =
newTree.number_of_children(attachNode);
381 if(nChildren <= 1) {
382oldParent =
newTree.parent(attachNode);
383 if(nChildren == 1) {
384z =
newTree.reparent(oldParent, attachNode.
begin(), next_sibling(attachNode.
begin()));
395 voidhead_initialise_();
397 template<
classStrictWeakOrdering>
424 template<
classT,
classtree_node_allocator>
429 if(one.node > two.
node)
return true;
437 template<
classT,
classtree_node_allocator>
443 template<
classT,
classtree_node_allocator>
450 template<
classT,
classtree_node_allocator>
455replace(begin(), other);
458 template<
classT,
classtree_node_allocator>
462alloc_.deallocate(
head,1);
463alloc_.deallocate(feet,1);
466 template<
classT,
classtree_node_allocator>
470feet = (
tree_node*) alloc_.allocate(1);
473 head->first_child=0;
475 head->prev_sibling=0;
476 head->next_sibling=feet;
481feet->prev_sibling=
head;
482feet->next_sibling=0;
485 template<
classT,
classtree_node_allocator>
491 template<
classT,
classtree_node_allocator>
498 template<
classT,
classtree_node_allocator>
503 while(it!=other.
end()) {
504to=insert(to, (*it));
510 while(it!=other.
end()) {
519 template<
classT,
classtree_node_allocator>
523 while(
head->next_sibling!=feet)
527 template<
classT,
classtree_node_allocator>
538alloc_.deallocate(
prev,1);
544 template<
classT,
classtree_node_allocator>
545 template<
classiter>
568alloc_.deallocate(cur,1);
572 template<
classT,
classtree_node_allocator>
578 template<
classT,
classtree_node_allocator>
584 template<
classT,
classtree_node_allocator>
589 while(
tmp->first_child)
595 template<
classT,
classtree_node_allocator>
601 template<
classT,
classtree_node_allocator>
605 unsigned intcurdepth=0;
606 while(curdepth<dp) {
607 while(
tmp->first_child==0) {
610 throwstd::range_error(
"tree: begin_fixed out of range");
618 template<
classT,
classtree_node_allocator>
623 unsigned intcurdepth=1;
624 while(curdepth<dp) {
625 while(
tmp->first_child==0) {
628 throwstd::range_error(
"tree: end_fixed out of range");
636 template<
classT,
classtree_node_allocator>
645 template<
classT,
classtree_node_allocator>
653 template<
classT,
classtree_node_allocator>
654 template<
typenameiter>
657 assert(position.node!=0);
658 returniter(position.node->parent);
661 template<
classT,
classtree_node_allocator>
668 template<
classT,
classtree_node_allocator>
678 template<
classT,
classtree_node_allocator>
679 template<
typenameiter>
689 tmp->parent=position.node;
690 if(position.node->last_child!=0) {
691position.node->last_child->next_sibling=
tmp;
694position.node->first_child=
tmp;
696 tmp->prev_sibling=position.node->last_child;
697position.node->last_child=
tmp;
698 tmp->next_sibling=0;
702 template<
classT,
classtree_node_allocator>
703 template<
classiter>
717 tmp->parent=position.node;
718 if(position.node->last_child!=0) {
719position.node->last_child->next_sibling=
tmp;
722position.node->first_child=
tmp;
724 tmp->prev_sibling=position.node->last_child;
725position.node->last_child=
tmp;
726 tmp->next_sibling=0;
730 template<
classT,
classtree_node_allocator>
731 template<
classiter>
737 returnreplace(aargh, other);
740 template<
classT,
classtree_node_allocator>
741 template<
classiter>
747insert_subtree(position.end(), from);
753 template<
classT,
classtree_node_allocator>
760 template<
classT,
classtree_node_allocator>
761 template<
classiter>
764 if(position.node==0) {
773 tmp->parent=position.node->parent;
774 tmp->next_sibling=position.node;
775 tmp->prev_sibling=position.node->prev_sibling;
776position.node->prev_sibling=
tmp;
778 if(
tmp->prev_sibling==0)
779 tmp->parent->first_child=
tmp;
781 tmp->prev_sibling->next_sibling=
tmp;
785 template<
classT,
classtree_node_allocator>
793 tmp->next_sibling=position.
node;
794 if(position.
node==0) {
797 tmp->parent->last_child=
tmp;
805 if(
tmp->prev_sibling==0)
806 tmp->parent->first_child=
tmp;
808 tmp->prev_sibling->next_sibling=
tmp;
812 template<
classT,
classtree_node_allocator>
813 template<
classiter>
821 tmp->parent=position.node->parent;
822 tmp->prev_sibling=position.node;
823 tmp->next_sibling=position.node->next_sibling;
824position.node->next_sibling=
tmp;
826 if(
tmp->next_sibling==0) {
828 tmp->parent->last_child=
tmp;
831 tmp->next_sibling->prev_sibling=
tmp;
836 template<
classT,
classtree_node_allocator>
837 template<
classiter>
843 returnreplace(it, subtree);
856 template<
classT,
classtree_node_allocator>
857 template<
classiter>
865 template<
classT,
classtree_node_allocator>
866 template<
classiter>
875erase_children(position);
896alloc_.deallocate(current_to,1);
908toit=append_child(toit, current_from->
data);
911 while(current_from->
next_sibling==0 && current_from!=start_from) {
912current_from=current_from->
parent;
917 if(current_from!=
last) {
918toit=append_child(parent(toit), current_from->
data);
921}
while(current_from!=
last);
926 template<
classT,
classtree_node_allocator>
936 while((++orig_begin)!=orig_end)
939 while((++new_begin)!=new_end)
951 if(new_first==new_last)
960 if(
next==orig_last)
971 template<
classT,
classtree_node_allocator>
972 template<
typenameiter>
975 if(position.node->first_child==0)
980 tmp->parent=position.node->parent;
983 if(position.node->next_sibling) {
984position.node->last_child->next_sibling=position.node->next_sibling;
985position.node->next_sibling->prev_sibling=position.node->last_child;
988position.node->parent->last_child=position.node->last_child;
990position.node->next_sibling=position.node->first_child;
991position.node->next_sibling->prev_sibling=position.node;
992position.node->first_child=0;
993position.node->last_child=0;
999 template<
classT,
classtree_node_allocator>
1000 template<
typenameiter>
1005 if(begin==end)
returnbegin;
1007 while((++begin)!=end) {
1011 if(
first->prev_sibling==0) {
1012 first->parent->first_child=
last->next_sibling;
1015 first->prev_sibling->next_sibling=
last->next_sibling;
1017 if(
last->next_sibling==0) {
1018 last->parent->last_child=
first->prev_sibling;
1021 last->next_sibling->prev_sibling=
first->prev_sibling;
1023 if(position.node->first_child==0) {
1024position.node->first_child=
first;
1025position.node->last_child=
last;
1026 first->prev_sibling=0;
1029position.node->last_child->next_sibling=
first;
1030 first->prev_sibling=position.node->last_child;
1031position.node->last_child=
last;
1033 last->next_sibling=0;
1037pos->
parent=position.node;
1038 if(pos==
last)
break;
1045 template<
classT,
classtree_node_allocator>
1048 if(from.node->first_child==0)
returnposition;
1049 returnreparent(position, from.node->first_child, end(from));
1052 template<
classT,
classtree_node_allocator>
1060 if(dst==src)
return source;
1070 elsedst->
parent->first_child=src;
1078 template<
classT,
classtree_node_allocator>
1081 boolduplicate_leaves)
1084 while(from1!=from2) {
1085 if((fnd=std::find(to1, to2, (*from1))) != to2) {
1086 if(from1.
begin()==from1.
end()) {
1087 if(duplicate_leaves)
1088append_child(parent(to1), (*from1));
1091merge(fnd.
begin(), fnd.
end(), from1.
begin(), from1.
end(), duplicate_leaves);
1095insert_subtree(to2, from1);
1101 template<
classT,
classtree_node_allocator>
1102 template<
classStrictWeakOrdering>
1106 staticStrictWeakOrdering comp;
1108 returncomp(
a->data,
b->data);
1111 template<
classT,
classtree_node_allocator>
1115 sort(from, to, comp, deep);
1118 template<
classT,
classtree_node_allocator>
1119 template<
classStrictWeakOrdering>
1121StrictWeakOrdering comp,
booldeep)
1123 if(from==to)
return;
1127std::multiset<tree_node *, compare_nodes<StrictWeakOrdering> > nodes;
1130nodes.insert(it.
node);
1139 typenamestd::multiset<tree_node *, compare_nodes<StrictWeakOrdering> >
::iteratornit=nodes.
begin(), eit=nodes.
end();
1141 if((*nit)->parent!=0)
1142(*nit)->parent->first_child=(*nit);
1144 else prev->next_sibling=(*nit);
1148(*nit)->prev_sibling=
prev;
1150 prev->next_sibling=(*nit);
1156 prev->next_sibling=(*eit);
1159(*eit)->next_sibling=
next;
1160(*eit)->prev_sibling=
prev;
1162 if((*eit)->parent!=0)
1163(*eit)->parent->last_child=(*eit);
1165 else next->prev_sibling=(*eit);
1172 sort(begin(bcs), end(bcs), comp, deep);
1178 template<
classT,
classtree_node_allocator>
1179 template<
typenameiter>
1182std::equal_to<T> comp;
1183 returnequal(one_, two, three_, comp);
1186 template<
classT,
classtree_node_allocator>
1187 template<
typenameiter>
1190std::equal_to<T> comp;
1191 returnequal_subtree(one_, two_, comp);
1194 template<
classT,
classtree_node_allocator>
1195 template<
typenameiter,
classBinaryPredicate>
1202 while(one!=two &&
is_valid(three)) {
1203 if(!fun(*one,*three))
1213 template<
classT,
classtree_node_allocator>
1214 template<
typenameiter,
classBinaryPredicate>
1219 if(!fun(*one,*two))
return false;
1220 if(number_of_children(one)!=number_of_children(two))
return false;
1221 returnequal(begin(one),end(one),begin(two),fun);
1224 template<
classT,
classtree_node_allocator>
1229 tmp.replace(
tmp.begin(),
tmp.end(), from, to);
1233 template<
classT,
classtree_node_allocator>
1237 tmp.replace(
tmp.begin(),
tmp.end(), from, to);
1240 template<
classT,
classtree_node_allocator>
1252 template<
classT,
classtree_node_allocator>
1259 template<
classT,
classtree_node_allocator>
1265 while(pos->
parent!=0) {
1272 template<
classT,
classtree_node_allocator>
1276 if(pos==0)
return0;
1288 template<
classT,
classtree_node_allocator>
1300 template<
classT,
classtree_node_allocator>
1335 template<
classT,
classtree_node_allocator>
1341 while(
tmp!=end) {
1342 if(
tmp==it)
return true;
1348 template<
classT,
classtree_node_allocator>
1351 if(it.
node==0 || it.
node==feet)
return false;
1355 template<
classT,
classtree_node_allocator>
1375 template<
classT,
classtree_node_allocator>
1381 tmp=
tmp->next_sibling;
1391 template<
classT,
classtree_node_allocator>
1393: node(0), skip_current_children_(
false)
1397 template<
classT,
classtree_node_allocator>
1399: node(tn), skip_current_children_(
false)
1403 template<
classT,
classtree_node_allocator>
1409 template<
classT,
classtree_node_allocator>
1412 return&(node->data);
1415 template<
classT,
classtree_node_allocator>
1418 if(other.
node!=this->node)
return true;
1422 template<
classT,
classtree_node_allocator>
1425 if(other.
node==this->node)
return true;
1429 template<
classT,
classtree_node_allocator>
1437 template<
classT,
classtree_node_allocator>
1445 template<
classT,
classtree_node_allocator>
1448skip_current_children_=
true;
1451 template<
classT,
classtree_node_allocator>
1455 if(pos==0)
return0;
1469 template<
classT,
classtree_node_allocator>
1475 template<
classT,
classtree_node_allocator>
1481 template<
classT,
classtree_node_allocator>
1487 template<
classT,
classtree_node_allocator>
1491 if(this->
node==0) {
1501 template<
classT,
classtree_node_allocator>
1505 if(!this->skip_current_children_ && this->node->first_child != 0) {
1506this->node=this->node->first_child;
1509this->skip_current_children_=
false;
1510 while(this->node->next_sibling==0) {
1511this->node=this->node->parent;
1515this->node=this->node->next_sibling;
1520 template<
classT,
classtree_node_allocator>
1524 if(this->node->prev_sibling) {
1525this->node=this->node->prev_sibling;
1526 while(this->node->last_child)
1527this->node=this->node->last_child;
1530this->node=this->node->parent;
1537 template<
classT,
classtree_node_allocator>
1545 template<
classT,
classtree_node_allocator>
1553 template<
classT,
classtree_node_allocator>
1563 template<
classT,
classtree_node_allocator>
1577 template<
classT,
classtree_node_allocator>
1583 template<
classT,
classtree_node_allocator>
1589 template<
classT,
classtree_node_allocator>
1595 template<
classT,
classtree_node_allocator>
1599 if(this->
node==0) {
1609 template<
classT,
classtree_node_allocator>
1613 if(this->node->next_sibling==0)
1614this->node=this->node->parent;
1616this->node=this->node->next_sibling;
1617 if(this->skip_current_children_) {
1618this->skip_current_children_=
false;
1621 while(this->node->first_child)
1622this->node=this->node->first_child;
1628 template<
classT,
classtree_node_allocator>
1632 if(this->skip_current_children_ || this->node->last_child==0) {
1633this->skip_current_children_=
false;
1634 while(this->node->prev_sibling==0)
1635this->node=this->node->parent;
1636this->node=this->node->prev_sibling;
1639this->node=this->node->last_child;
1644 template<
classT,
classtree_node_allocator>
1652 template<
classT,
classtree_node_allocator>
1661 template<
classT,
classtree_node_allocator>
1671 template<
classT,
classtree_node_allocator>
1681 template<
classT,
classtree_node_allocator>
1685 while(this->node->first_child)
1686this->node=this->node->first_child;
1692 template<
classT,
classtree_node_allocator>
1699 template<
classT,
classtree_node_allocator>
1706 template<
classT,
classtree_node_allocator>
1713 template<
classT,
classtree_node_allocator>
1720 template<
classT,
classtree_node_allocator>
1722:
iterator_base(other.node), first_parent_(other.first_parent_)
1726 template<
classT,
classtree_node_allocator>
1732 if(this->node==0)
return;
1733 if(this->node->parent!=0)
1734first_parent_=this->node->parent;
1736find_leftmost_parent_();
1739 template<
classT,
classtree_node_allocator>
1747first_parent_=tmppar;
1751 template<
classT,
classtree_node_allocator>
1755 if(this->node->next_sibling!=0) {
1756this->node=this->node->next_sibling;
1758 if(this->node->parent==0 && this->node->next_sibling==0)
1775 template<
classT,
classtree_node_allocator>
1779 if(this->node->prev_sibling!=0) {
1780this->node=this->node->prev_sibling;
1782 if(this->node->parent==0 && this->node->prev_sibling==0)
1799 template<
classT,
classtree_node_allocator>
1807 template<
classT,
classtree_node_allocator>
1815 template<
classT,
classtree_node_allocator>
1825 template<
classT,
classtree_node_allocator>
1840 template<
classT,
classtree_node_allocator>
1847 template<
classT,
classtree_node_allocator>
1854 template<
classT,
classtree_node_allocator>
1861 template<
classT,
classtree_node_allocator>
1867 template<
classT,
classtree_node_allocator>
1871 if(this->node==0)
return;
1872 if(this->node->parent!=0)
1873parent_=this->node->parent;
1876 template<
classT,
classtree_node_allocator>
1880this->node=this->node->next_sibling;
1884 template<
classT,
classtree_node_allocator>
1887 if(this->node) this->node=this->node->prev_sibling;
1890this->node=parent_->last_child;
1895 template<
classT,
classtree_node_allocator>
1903 template<
classT,
classtree_node_allocator>
1911 template<
classT,
classtree_node_allocator>
1921 template<
classT,
classtree_node_allocator>
1931 template<
classT,
classtree_node_allocator>
1938 template<
classT,
classtree_node_allocator>
fixed_depth_iterator & operator--()
tree_node * first_parent_
fixed_depth_iterator & operator+=(unsigned int)
fixed_depth_iterator & operator++()
void find_leftmost_parent_()
fixed_depth_iterator & operator-=(unsigned int)
bool operator()(const typename tree< T, tree_node_allocator >::iterator_base &one, const typename tree< T, tree_node_allocator >::iterator_base &two) const
sibling_iterator end() const
bool operator!=(const iterator_base &) const
std::bidirectional_iterator_tag iterator_category
bool operator==(const iterator_base &) const
bool skip_current_children_
unsigned int number_of_children() const
sibling_iterator begin() const
ptrdiff_t difference_type
post_order_iterator & operator+=(unsigned int)
post_order_iterator & operator-=(unsigned int)
post_order_iterator & operator++()
post_order_iterator & operator--()
pre_order_iterator & operator++()
pre_order_iterator & operator--()
pre_order_iterator & operator+=(unsigned int)
pre_order_iterator & operator-=(unsigned int)
tree_node * range_first() const
sibling_iterator & operator--()
tree_node * range_last() const
sibling_iterator & operator++()
sibling_iterator & operator+=(unsigned int)
sibling_iterator & operator-=(unsigned int)
tree_node_< T > * next_sibling
tree_node_< T > * last_child
tree_node_< T > * first_child
tree_node_< T > * prev_sibling
post_order_iterator begin_post() const
void erase_children(const iterator_base &)
bool equal_subtree(const iter &one, const iter &two) const
bool equal(const iter &one, const iter &two, const iter &three) const
sibling_iterator child(const iterator_base &position, unsigned int) const
void merge(sibling_iterator, sibling_iterator, sibling_iterator, sibling_iterator, bool duplicate_leaves=false)
pre_order_iterator iterator
iter insert_after(iter position, const T &x)
void copy_(const tree< T, tree_node_allocator > &other)
sibling_iterator previous_sibling(const iterator_base &) const
void sort(sibling_iterator from, sibling_iterator to, bool deep=false)
sibling_iterator next_sibling(const iterator_base &) const
tree_node_< T > tree_node
iter insert_subtree(iter position, const iterator_base &subtree)
tree_node_allocator alloc_
int depth(const iterator_base &) const
bool is_valid(const iterator_base &) const
post_order_iterator end_post() const
void operator=(const tree< T, tree_node_allocator > &)
iter append_child(iter position)
tree reroot(iterator newRoot)
unsigned int index(sibling_iterator it) const
bool is_in_subtree(const iterator_base &position, const iterator_base &begin, const iterator_base &end) const
iter replace(iter position, const T &x)
iter move_after(iter target, iter source)
iter append_children(iter position, sibling_iterator from, sibling_iterator to)
pre_order_iterator begin() const
iter insert(iter position, const T &x)
fixed_depth_iterator begin_fixed(const iterator_base &, unsigned int) const
unsigned int number_of_children(const iterator_base &) const
fixed_depth_iterator end_fixed(const iterator_base &, unsigned int) const
iter move_below(iter target, iter source)
iter reparent(iter position, sibling_iterator begin, sibling_iterator end)
void swap(sibling_iterator it)
pre_order_iterator set_head(const T &x)
iter flatten(iter position)
unsigned int number_of_siblings(const iterator_base &) const
tree subtree(sibling_iterator from, sibling_iterator to) const
pre_order_iterator end() const
iter move_before(iter target, iter source)
static bool is_valid(const char *num, int type, CONV_RESULT *cr)
static unsigned char depth[2 *(256+1+29)+1]
bool operator==(const CEquivRange &A, const CEquivRange &B)
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
CVect2< NCBI_PROMOTE(int,U) > operator*(int v1, const CVect2< U > &v2)
bool operator!=(const CNCBI_IPAddr &lhs, unsigned int rhs)
#define NCBI_CDUTILS_EXPORT
CNcbiMatrix< T > & operator+=(CNcbiMatrix< T > &, const CNcbiMatrix< U > &)
global addition: matrix += matrix
CNcbiMatrix< T > & operator-=(CNcbiMatrix< T > &, const CNcbiMatrix< U > &)
global subtraction: matrix -= matrix
constexpr auto sort(_Init &&init)
constexpr bool empty(list< Ts... >) noexcept
void constructor(T1 *p, T2 &val)
double value_type
The numeric datatype used by the parser.
const struct ncbi::grid::netcache::search::fields::SIZE size
const CharType(& source)[N]
S & operator--(CNetRef< S > &r, int)
void flatten(size_t dimension_, const Int4 *const *scoreMatrix_, const double *const *prob_, size_t *dim_, Int4 **score_, double **p_, size_t dimension2_=0)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
bool operator>(const typename tree< T, tree_node_allocator >::iterator_base &one, const typename tree< T, tree_node_allocator >::iterator_base &two)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4