设为首页 加入收藏

TOP

基于顺序存储的多叉树实现: (3) 前序遍历 (三)
2014-11-23 22:57:32 来源: 作者: 【 】 浏览:9
Tags:基于 顺序 存储 实现
ine typename mtree::template pre_iterator_impl&
12 mtree::pre_iterator_impl::operator--()
13 {
14 decrement(typename reverse_trait::type());
15 return *this;
16 }
17 template
18 template
19 inline typename mtree::template pre_iterator_impl
20 mtree::pre_iterator_impl::operator++(int)
21 {
22 pre_iterator_impl iter(*this);
23 ++(*this);
24 return iter;
25 }
26 template
27 template
28 inline typename mtree::template pre_iterator_impl
29 mtree::pre_iterator_impl::operator--(int)
30 {
31 pre_iterator_impl iter(*this);
32 --(*this);
33 return iter;
34 }
35 template
36 template
37 inline typename mtree::template pre_iterator_impl
38 mtree::pre_iterator_impl::operator + (size_t off)
39 {
40 pre_iterator_impl iter(*this);
41 iter += off;
42 return iter;
43 }
44 template
45 template
46 inline typename mtree::template pre_iterator_impl&
47 mtree::pre_iterator_impl::operator += (size_t off)
48 {
49 while (off)
50 {
51 if (base_type::is_null()) break;
52 ++(*this); --off;
53 }
54 return *this;
55 }
56 template
57 template
58 inline typename mtree::template pre_iterator_impl
59 mtree::pre_iterator_impl::operator - (size_t off)
60 {
61 pre_iterator_impl iter(*this);
62 iter -= off;
63 return iter;
64 }
65 template
66 template
67 inline typename mtree::template pre_iterator_impl&
68 mtree::pre_iterator_impl::operator -= (size_t off)
69 {
70 while (off)
71 {
72 if (base_type::is_null()) break;
73 --(*this); --off;
74 }
75 return *this;
76 }
77 template
78 template
79 inline typename mtree::template pre_iterator_impl
80 mtree::pre_iterator_impl::begin() const
81 {
82 pre_iterator_impl iter(*this);
83 iter.first(typename reverse_trait::type());
84 return iter;
85 }
86 template
87 template
88 inline typename mtree::template pre_iterator_impl
89 mtree::pre_iterator_impl::end() const
90 {
91 pre_iterator_impl iter(*this);
92 if (tree_)
93 {
94 iter.off_ = tree_->size();
95 }
96 return iter;
97 }
(7)间隔层定位方法的实现,代码如下:

1template
2 template
3 inline void mtree::pre_iterator_impl::first(no_reverse_tag)
4 {
5 assert(tree_&&root_size());
6 forward_first();
7 }
8 template
9 template
10 inline void mtree::pre_iterator_impl::first(reverse_tag)
11 {
12 assert(tree_&&root_size());
13 forward_last();
14 }
15 template
16 template
17 inline void mtree::pre_iterator_impl::last(no_reverse_tag)
18 {
19 assert(tree_&&root_size());
20 forward_last();
21 }
22 template
23 template
24 inline void mtree::pre_iterator_impl::last(reverse_tag)
25 {
26 assert(tree_&&root_size());
27 forward_first();
28 }
29 template
30 template
31 inline void mtree::pre_iterator_impl::increment(no_reverse_tag)
32 {
33 assert(tree_&&off_<=tree_->size());
34 off_!=tree_->size() forward_next() : first(no_reverse_tag());
35 }
36 template
37 templa

首页 上一页 1 2 3 4 下一页 尾页 3/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇对象的消息模型 下一篇C语言进行远程注入进程

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: