亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? tree.hh

?? 一個(gè)德國(guó)人Kasper Peeters用C++ template寫(xiě)的tree的STL實(shí)現(xiàn)
?? HH
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
/*    $Id: tree.hh,v 1.125 2006/01/31 17:44:43 kp229 Exp $   STL-like templated tree class.   Copyright (C) 2001-2006  Kasper Peeters <kasper.peeters@aei.mpg.de>.*//** \mainpage tree.hh    \author   Kasper Peeters    \version  2.03    \date     01-Mar-2006    \see      http://www.aei.mpg.de/~peekas/tree/    \see      http://www.aei.mpg.de/~peekas/tree/ChangeLog   The tree.hh library for C++ provides an STL-like container class   for n-ary trees, templated over the data stored at the   nodes. Various types of iterators are provided (post-order,   pre-order, and others). Where possible the access methods are   compatible with the STL or alternative algorithms are   available. *//*   This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; version 2.      This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.      You should have received a copy of the GNU General Public License   along with this program; if not, write to the Free Software   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*//** \todo    - New-style move members are not completely finished yet.   - Fixed depth iterators do not iterate over the entire range if there     are 'holes' in the tree.   - If a range uses const iter_base& as end iterator, things will     inevitably go wrong, because upcast from iter_base to a non-sibling_iter     is incorrect. This upcast should be removed (and then all illegal uses     as previously in 'equal' will be flagged by the compiler). This requires     new copy constructors though.   - There's a bug in replace(sibling_iterator, ...) when the ranges     sit next to each other. Turned up in append_child(iter,iter)     but has been avoided now.   - "std::operator<" does not work correctly on our iterators, and for some     reason a globally defined template operator< did not get picked up.      Using a comparison class now, but this should be investigated.*/#ifndef tree_hh_#define tree_hh_#include <cassert>#include <memory>#include <stdexcept>#include <iterator>#include <set>#include <queue>// HP-style construct/destroy have gone from the standard,// so here is a copy.namespace kp {template <class T1, class T2>void constructor(T1* p, T2& val)    {   new ((void *) p) T1(val);   }template <class T1>void constructor(T1* p)    {   new ((void *) p) T1;   }template <class T1>void destructor(T1* p)   {   p->~T1();   }};/// A node in the tree, combining links to other nodes as well as the actual data.template<class T>class tree_node_ { // size: 5*4=20 bytes (on 32 bit arch), can be reduced by 8.   public:      tree_node_<T> *parent;      tree_node_<T> *first_child, *last_child;      tree_node_<T> *prev_sibling, *next_sibling;      T data;}; // __attribute__((packed));template <class T, class tree_node_allocator = std::allocator<tree_node_<T> > >class tree {   protected:      typedef tree_node_<T> tree_node;   public:      /// Value of the data stored at a node.      typedef T value_type;      class iterator_base;      class pre_order_iterator;      class post_order_iterator;      class sibling_iterator;      tree();      tree(const T&);      tree(const iterator_base&);      tree(const tree<T, tree_node_allocator>&);      ~tree();      void operator=(const tree<T, tree_node_allocator>&);      /// Base class for iterators, only pointers stored, no traversal logic.#ifdef __SGI_STL_PORT      class iterator_base : public stlport::bidirectional_iterator<T, ptrdiff_t> {#else      class iterator_base {#endif         public:            typedef T                               value_type;            typedef T*                              pointer;            typedef T&                              reference;            typedef size_t                          size_type;            typedef ptrdiff_t                       difference_type;            typedef std::bidirectional_iterator_tag iterator_category;            iterator_base();            iterator_base(tree_node *);            T&             operator*() const;            T*             operator->() const;            /// When called, the next increment/decrement skips children of this node.            void         skip_children();            /// Number of children of the node pointed to by the iterator.            unsigned int number_of_children() const;            sibling_iterator begin() const;            sibling_iterator end() const;            tree_node *node;         protected:            bool skip_current_children_;      };      /// Depth-first iterator, first accessing the node, then its children.      class pre_order_iterator : public iterator_base {          public:            pre_order_iterator();            pre_order_iterator(tree_node *);            pre_order_iterator(const iterator_base&);            pre_order_iterator(const sibling_iterator&);            bool    operator==(const pre_order_iterator&) const;            bool    operator!=(const pre_order_iterator&) const;            pre_order_iterator&  operator++();            pre_order_iterator&  operator--();            pre_order_iterator   operator++(int);            pre_order_iterator   operator--(int);            pre_order_iterator&  operator+=(unsigned int);            pre_order_iterator&  operator-=(unsigned int);      };      /// Depth-first iterator, first accessing the children, then the node itself.      class post_order_iterator : public iterator_base {         public:            post_order_iterator();            post_order_iterator(tree_node *);            post_order_iterator(const iterator_base&);            post_order_iterator(const sibling_iterator&);            bool    operator==(const post_order_iterator&) const;            bool    operator!=(const post_order_iterator&) const;            post_order_iterator&  operator++();            post_order_iterator&  operator--();            post_order_iterator   operator++(int);            post_order_iterator   operator--(int);            post_order_iterator&  operator+=(unsigned int);            post_order_iterator&  operator-=(unsigned int);            /// Set iterator to the first child as deep as possible down the tree.            void descend_all();      };      /// Breadth-first iterator, using a queue      class breadth_first_queued_iterator : public iterator_base {         public:            breadth_first_queued_iterator();            breadth_first_queued_iterator(tree_node *);            breadth_first_queued_iterator(const iterator_base&);            bool    operator==(const breadth_first_queued_iterator&) const;            bool    operator!=(const breadth_first_queued_iterator&) const;            breadth_first_queued_iterator&  operator++();            breadth_first_queued_iterator   operator++(int);            breadth_first_queued_iterator&  operator+=(unsigned int);         private:            std::queue<tree_node *> traversal_queue;      };      /// The default iterator types throughout the tree class.      typedef pre_order_iterator            iterator;      typedef breadth_first_queued_iterator breadth_first_iterator;      /// Iterator which traverses only the nodes at a given depth from the root.      class fixed_depth_iterator : public iterator_base {         public:            fixed_depth_iterator();            fixed_depth_iterator(tree_node *);            fixed_depth_iterator(const iterator_base&);            fixed_depth_iterator(const sibling_iterator&);            fixed_depth_iterator(const fixed_depth_iterator&);            bool    operator==(const fixed_depth_iterator&) const;            bool    operator!=(const fixed_depth_iterator&) const;            fixed_depth_iterator&  operator++();            fixed_depth_iterator&  operator--();            fixed_depth_iterator   operator++(int);            fixed_depth_iterator   operator--(int);            fixed_depth_iterator&  operator+=(unsigned int);            fixed_depth_iterator&  operator-=(unsigned int);            tree_node *first_parent_;         private:            void set_first_parent_();            void find_leftmost_parent_();      };      /// Iterator which traverses only the nodes which are siblings of each other.      class sibling_iterator : public iterator_base {         public:            sibling_iterator();            sibling_iterator(tree_node *);            sibling_iterator(const sibling_iterator&);            sibling_iterator(const iterator_base&);            bool    operator==(const sibling_iterator&) const;            bool    operator!=(const sibling_iterator&) const;            sibling_iterator&  operator++();            sibling_iterator&  operator--();            sibling_iterator   operator++(int);            sibling_iterator   operator--(int);            sibling_iterator&  operator+=(unsigned int);            sibling_iterator&  operator-=(unsigned int);            tree_node *range_first() const;            tree_node *range_last() const;            tree_node *parent_;         private:            void set_parent_();      };      /// Return iterator to the beginning of the tree.      inline pre_order_iterator   begin() const;      /// Return iterator to the end of the tree.      inline pre_order_iterator   end() const;      /// Return post-order iterator to the beginning of the tree.      post_order_iterator  begin_post() const;      /// Return post-order iterator to the end of the tree.      post_order_iterator  end_post() const;      /// Return fixed-depth iterator to the first node at a given depth.      fixed_depth_iterator begin_fixed(const iterator_base&, unsigned int) const;      /// Return fixed-depth iterator to end of the nodes at given depth.      fixed_depth_iterator end_fixed(const iterator_base&, unsigned int) const;      /// Return breadth-first iterator to the first node at a given depth.      breadth_first_queued_iterator begin_breadth_first() const;      /// Return breadth-first iterator to end of the nodes at given depth.      breadth_first_queued_iterator end_breadth_first() const;      /// Return sibling iterator to the first child of given node.      sibling_iterator     begin(const iterator_base&) const;      /// Return sibling iterator to the end of the children of a given node.      sibling_iterator     end(const iterator_base&) const;      /// Return iterator to the parent of a node.      template<typename iter> iter parent(iter) const;      /// Return iterator to the previous sibling of a node.      template<typename iter> iter previous_sibling(iter) const;      /// Return iterator to the next sibling of a node.      template<typename iter> iter next_sibling(iter) const;      /// Return iterator to the next node at a given depth.      template<typename iter> iter next_at_same_depth(iter) const;      /// Erase all nodes of the tree.      void     clear();      /// Erase element at position pointed to by iterator, return incremented iterator.      template<typename iter> iter erase(iter);      /// Erase all children of the node pointed to by iterator.      void     erase_children(const iterator_base&);      /// Insert empty node as last child of node pointed to by position.      template<typename iter> iter append_child(iter position);       /// Insert node as last child of node pointed to by position.      template<typename iter> iter append_child(iter position, const T& x);      /// Append the node (plus its children) at other_position as a child of position.      template<typename iter> iter append_child(iter position, iter other_position);      /// Append the nodes in the from-to range (plus their children) as children of position.      template<typename iter> iter append_children(iter position, sibling_iterator from, sibling_iterator to);      /// Short-hand to insert topmost node in otherwise empty tree.      pre_order_iterator set_head(const T& x);      /// Insert node as previous sibling of node pointed to by position.      template<typename iter> iter insert(iter position, const T& x);      /// Specialisation of previous member.      sibling_iterator insert(sibling_iterator position, const T& x);      /// Insert node (with children) pointed to by subtree as previous sibling of node pointed to by position.      template<typename iter> iter insert_subtree(iter position, const iterator_base& subtree);      /// Insert node as next sibling of node pointed to by position.      template<typename iter> iter insert_after(iter position, const T& x);      /// Replace node at 'position' with other node (keeping same children); 'position' becomes invalid.      template<typename iter> iter replace(iter position, const T& x);      /// Replace node at 'position' with subtree starting at 'from' (do not erase subtree at 'from'); see above.      template<typename iter> iter replace(iter position, const iterator_base& from);      /// Replace string of siblings (plus their children) with copy of a new string (with children); see above      sibling_iterator replace(sibling_iterator orig_begin, sibling_iterator orig_end,                                sibling_iterator new_begin,  sibling_iterator new_end);       /// Move all children of node at 'position' to be siblings, returns position.      template<typename iter> iter flatten(iter position);      /// Move nodes in range to be children of 'position'.      template<typename iter> iter reparent(iter position, sibling_iterator begin, sibling_iterator end);      /// Move all child nodes of 'from' to be children of 'position'.      template<typename iter> iter reparent(iter position, iter from);      /// Move 'source' node (plus its children) to become the next sibling of 'target'.      template<typename iter> iter move_after(iter target, iter source);      /// Move 'source' node (plus its children) to become the previous sibling of 'target'.      template<typename iter> iter move_before(iter target, iter source);      sibling_iterator move_before(sibling_iterator target, sibling_iterator source);      /// Move 'source' node (plus its children) to become the node at 'target' (erasing the node at 'target').      template<typename iter> iter move_ontop(iter target, iter source);      /// Merge with other tree, creating new branches and leaves only if they are not already present.      void     merge(sibling_iterator, sibling_iterator, sibling_iterator, sibling_iterator,                      bool duplicate_leaves=false);      /// Sort (std::sort only moves values of nodes, this one moves children as well).      void     sort(sibling_iterator from, sibling_iterator to, bool deep=false);      template<class StrictWeakOrdering>      void     sort(sibling_iterator from, sibling_iterator to, StrictWeakOrdering comp, bool deep=false);      /// Compare two ranges of nodes (compares nodes as well as tree structure).      template<typename iter>      bool     equal(const iter& one, const iter& two, const iter& three) const;      template<typename iter, class BinaryPredicate>      bool     equal(const iter& one, const iter& two, const iter& three, BinaryPredicate) const;      template<typename iter>      bool     equal_subtree(const iter& one, const iter& two) const;      template<typename iter, class BinaryPredicate>      bool     equal_subtree(const iter& one, const iter& two, BinaryPredicate) const;      /// Extract a new tree formed by the range of siblings plus all their children.      tree     subtree(sibling_iterator from, sibling_iterator to) const;      void     subtree(tree&, sibling_iterator from, sibling_iterator to) const;      /// Exchange the node (plus subtree) with its sibling node (do nothing if no sibling present).      void     swap(sibling_iterator it);            /// Count the total number of nodes.      int      size() const;      /// Check if tree is empty.      bool     empty() const;      /// Compute the depth to the root.      int      depth(const iterator_base&) const;      /// Count the number of children of node at position.      static unsigned int number_of_children(const iterator_base&);      /// Count the number of 'next' siblings of node at iterator.      unsigned int number_of_siblings(const iterator_base&) const;      /// Determine whether node at position is in the subtrees with root in the range.      bool     is_in_subtree(const iterator_base& position, const iterator_base& begin,                              const iterator_base& end) const;      /// Determine whether the iterator is an 'end' iterator and thus not actually pointing to a node.      bool     is_valid(const iterator_base&) const;      /// Determine the index of a node in the range of siblings to which it belongs.      unsigned int index(sibling_iterator it) const;      /// Inverse of 'index': return the n-th child of the node at position.      sibling_iterator  child(const iterator_base& position, unsigned int) const;            /// Comparator class for iterators (compares pointer values; why doesn't this work automatically?)      class iterator_base_less {         public:            bool operator()(const typename tree<T, tree_node_allocator>::iterator_base& one,                            const typename tree<T, tree_node_allocator>::iterator_base& two) const               {               return one.node < two.node;               }      };      tree_node *head, *feet;    // head/feet are always dummy; if an iterator points to them it is invalid   private:      tree_node_allocator alloc_;      void head_initialise_();      void copy_(const tree<T, tree_node_allocator>& other);      /// Comparator class for two nodes of a tree (used for sorting and searching).

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产丝袜欧美中文另类| 盗摄精品av一区二区三区| 免费高清在线一区| 国产精品亚洲一区二区三区妖精| 成人97人人超碰人人99| 欧美网站一区二区| 久久久久久久久伊人| 一区二区三区不卡在线观看| 日本欧美在线观看| www.一区二区| 欧美精品色综合| 国产精品日韩精品欧美在线| 91在线观看下载| 欧美裸体bbwbbwbbw| 久久久久综合网| 亚洲网友自拍偷拍| 国产91在线|亚洲| 欧美日韩电影一区| 国产精品三级av在线播放| 日本美女一区二区| av不卡免费电影| 欧美一二三区精品| 一区二区三区色| 国内精品久久久久影院色| 色综合久久中文综合久久97| 精品欧美乱码久久久久久 | 99热国产精品| 日韩精品一区二区三区swag| 一区二区视频在线看| 精品一区二区久久久| 欧美亚洲自拍偷拍| 国产精品看片你懂得| 久久精品国产成人一区二区三区| 色综合天天综合| 久久九九久久九九| 美女视频黄 久久| 欧美中文字幕不卡| 中文字幕在线免费不卡| 久久99精品久久久久久动态图| 欧美色视频在线| 亚洲三级免费观看| 成人黄色综合网站| 久久久亚洲精品石原莉奈| 日本v片在线高清不卡在线观看| 91视频com| 国产精品网站在线观看| 国内外成人在线| 欧美一级片在线看| 五月激情综合婷婷| 欧美艳星brazzers| 一区二区免费视频| 97精品久久久久中文字幕| 国产三级精品视频| 精品一区二区国语对白| 日韩免费高清av| 欧美一区二区三区视频免费播放| 亚洲精品综合在线| 波多野结衣精品在线| 久久久99久久| 国产黄色精品网站| 26uuu久久天堂性欧美| 蜜桃传媒麻豆第一区在线观看| 欧美日本在线视频| 婷婷久久综合九色国产成人| 欧美性大战久久久久久久蜜臀| 亚洲视频免费在线| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 欧美疯狂性受xxxxx喷水图片| 亚洲综合小说图片| 欧亚一区二区三区| 亚洲一区二区不卡免费| 色婷婷综合久久久久中文| 一区二区三区久久| 色偷偷88欧美精品久久久| 亚洲欧美日韩在线| 91国内精品野花午夜精品| 亚洲免费观看在线视频| 色综合天天综合网国产成人综合天| 亚洲青青青在线视频| 在线免费观看日韩欧美| 香蕉av福利精品导航| 欧美精品粉嫩高潮一区二区| 日本不卡免费在线视频| 精品乱人伦一区二区三区| 精品午夜久久福利影院| 国产日韩影视精品| 97成人超碰视| 亚洲成a人片在线不卡一二三区| 欧美久久久久久蜜桃| 免费不卡在线视频| 国产亚洲一本大道中文在线| www.在线成人| 亚洲va欧美va人人爽午夜| 欧美一区二区视频在线观看2022| 美女脱光内衣内裤视频久久网站| 精品av综合导航| 成人午夜看片网址| 一区二区三区影院| 欧美一级免费观看| 国产盗摄女厕一区二区三区| 亚洲人亚洲人成电影网站色| 欧美三级蜜桃2在线观看| 狠狠色丁香婷婷综合久久片| 国产精品久久久久一区| 欧美日韩视频在线观看一区二区三区 | 粉嫩一区二区三区性色av| 综合久久久久久久| 欧美一区二区视频观看视频| 国产美女一区二区三区| 亚洲精品国产无天堂网2021| 欧美日韩国产综合一区二区 | 精品电影一区二区三区| 亚洲国产岛国毛片在线| 色婷婷亚洲精品| 久久99国产精品麻豆| 国产精品萝li| 欧美久久久一区| 成人午夜av影视| 亚洲大片免费看| 国产日韩欧美制服另类| 欧美日韩午夜影院| 成人自拍视频在线| 婷婷国产在线综合| 中文av一区二区| 欧美一区日韩一区| 成人国产精品免费观看| 视频在线观看91| 国产欧美日韩在线| 欧美日韩国产影片| 成人av综合在线| 久久国产精品一区二区| 一区二区三区免费看视频| 精品国产一区二区精华| 欧美综合在线视频| 国产成人午夜高潮毛片| 午夜成人免费视频| 中文字幕一区二区三区四区| 日韩一区二区三区免费观看| 99精品欧美一区| 国产一区二区三区高清播放| 亚洲国产va精品久久久不卡综合 | 91丨九色porny丨蝌蚪| 久久99热这里只有精品| 亚洲国产日韩精品| 国产精品蜜臀av| 精品国产乱码久久久久久牛牛| 欧美系列一区二区| 国产91对白在线观看九色| 久久se精品一区二区| 亚洲国产精品天堂| 亚洲女同ⅹxx女同tv| 26uuu另类欧美| 日韩免费高清视频| 欧美日韩免费观看一区三区| 不卡在线观看av| 国产精品主播直播| 蜜桃视频在线观看一区二区| 亚洲一区二区三区四区五区黄| 国产精品高潮久久久久无| xfplay精品久久| 日韩一区二区精品| 欧美日韩国产美| 日本电影亚洲天堂一区| caoporen国产精品视频| 国产成人综合亚洲网站| 精品在线亚洲视频| 日韩av中文在线观看| 亚洲一二三四在线| 一区二区三区欧美激情| 国产精品久久久99| 欧美激情中文字幕| 日本一区二区三区四区 | 风流少妇一区二区| 国模套图日韩精品一区二区| 日本美女一区二区三区| 日韩国产欧美三级| 亚洲h在线观看| 午夜精品久久久久久久久久| 亚洲在线一区二区三区| 樱桃视频在线观看一区| 亚洲激情成人在线| 亚洲人成人一区二区在线观看| 亚洲色图欧洲色图婷婷| ...xxx性欧美| 亚洲欧美日韩在线| 一区二区三区丝袜| 亚洲v中文字幕| 日韩av一级电影| 麻豆精品蜜桃视频网站| 久久av老司机精品网站导航| 国精产品一区一区三区mba桃花 | 久久先锋影音av| 久久久99精品免费观看不卡| 久久久久久久性| 亚洲国产高清在线| 亚洲三级视频在线观看| 亚洲激情一二三区| 性欧美大战久久久久久久久| 日本美女一区二区三区| 国产一区二区三区最好精华液|