tree<std::string> tr9;
tree<std::string>::pre_order_iterator iter1;
tr9.set_head("hi");
tr9.insert_after(tr9.begin(), "a");
tr9.insert_after(tr9.begin(), "b");
tr9.append_child(tr9.begin(), "0");
tr9.append_child(tr9.begin().begin(), "0.1");
tr9.append_child(tr9.begin().begin(), "0.0");

iter1 = tr9.begin();
int num1 = iter1.number_of_children();
if (num1 > 0) {
iter1 = tr9.child(iter1, num1 - 1);
if (iter1 == NULL)
XTRACE_RAW(COLOR_BLACK, "null iter?\n");
else
tr9.insert_after(iter1, "2");
} else {
tr9.append_child(tr9.begin(), "1");
}
print_tree(tr9, tr9.begin(), tr9.end());
int depth1 = tr9.depth(tr9.begin());
int depth2 = tr9.depth(tr9.begin().begin());
int size1 = tr9.size();
int size2 = tr9.size(tr9.begin());

tree<std::string> tr;
tree<std::string>::pre_order_iterator html, body, h1, h3, bh1, mv1;

print_tree(tr, tr.begin(), tr.end());

html=tr.insert(tr.begin(), "html");
tr.insert_after(html, "extra");
body=tr.append_child(html, "body");
h1 =tr.append_child(body, "h1");
bh1 = tr.insert_after(h1, "after h1");
auto aa = tr.parent(bh1);
tr.append_child(aa, "some textaaa");
tr.append_child(h1, "some text");
tr.append_child(body, "more text");

print_tree(tr, tr.begin(), tr.end());

XTRACE_RAW(COLOR_BLACK, L"test finish\n");

url: http://tree.phi-sci.com/

一个不错的多叉树, stl风格的更多相关文章

  1. 一个不错的loading效果--IT蓝豹

    一个不错的loading效果 介绍:一个不错的loading加载效果,弹性收缩,效果不错,学习android动画的朋友可以下载来研究研究本例子其实由SeekBar实现,由MetaballView,Me ...

  2. datetimepicker一个不错的日历android特效

    datetimepicker一个不错的日历效,选中和选择日历效果都很不错, 实用的时候直接可以把datetimepicker-library这个引入到项目,调用的地方在实现 TimePickerDia ...

  3. 一个不错的shell 脚本教程 入门级

    一个很不错的bash脚本编写教程,至少没接触过BASH的也能看懂     建立一个脚本 Linux中有好多中不同的shell,但是通常我们使用bash (bourne again shell) 进行s ...

  4. 【转】一个不错的eclipse反编译插件

    [转]一个不错的eclipse反编译插件 在CSDN论坛上看到的一个不错的eclipse反编译插件,感觉看起来不错的样子,因而记下,原网址是:http://topic.csdn.net/u/20121 ...

  5. 一个不错的图片滑动展示插件 anythingslider

    一个不错的图片http://css-tricks.com/anythingslider-jquery-plugin/ DEMO演示: http://css-tricks.github.io/Anyth ...

  6. linux中内核的一个不错的参数somaxconn

    导读:在linux中,/proc/sys/net/core/somaxconn这个参数,linux中内核的一个不错的参数somaxconn 看下其解析: 对于一个TCP连接,Server与Client ...

  7. 一个不错的PPT,扁平化设计,开放资源,要的进来

    开了那么多的博客,没做啥资源贡献,今天共享一个不错的PPT模板.例如以下图所看到的,须要的话留下邮箱 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbGFp ...

  8. [置顶] ios 一个不错的图片浏览分享框架demo

    demo功能:一个不错的图片浏览分享框架demo.iphone6.1 测试通过.可以浏览图片,保存,微博分享到新浪,腾讯,网易,人人等. 注:(由于各个微博的接口有时候会有调整,不一定能分享成功.只看 ...

  9. 分享一个不错的Unittest测试报告

    分享一个不错的,unittest测试报告. 先上图: 代码如下: 复制下来保存成py可用 #coding=utf-8 """ A TestRunner for use w ...

随机推荐

  1. 调试dump文件

    1.设置好pdb文件和源代码路径 为了能正确分析Dump文件,我们必须要指定和程序一起出来的PDB文件,如果程序重新被编译了一次,即使代码没有任何变化,之前的PDB文件我们不能再继续使用.

  2. IntelliJ IDEA 设置背景图片

    1.在idea中 按快捷键   Ctrl+Shift+A   出现如图 输入  Set Background Image  双击  Set Background Image 2.选择要添加的图片的路径 ...

  3. OO第一单元(求导)单元总结

    OO第一单元(求导)单元总结 这是我们oo课程的第一个单元,也是意在让我们接触了解掌握oo思想的一个单元,这个单元的作业以求导为主题,从一开始的加减多项式求导再到最后的嵌套多项式求导,难度逐渐提高,编 ...

  4. 【C语言基础】什么是字节?

    字节就是存储数据的单位,并且是硬件所能访问的最小单位. 一个字节控制8位 int 类型为4个字节 long 类型为8个字节 char 类型为1个字节:Java中为两个字节

  5. [python]关于函数传入参数

    在传入参数时有两个特殊参数,*args,**kwargs,功能如下: def foo(*args, **kwargs): print 'args = ', args print 'kwargs = ' ...

  6. xcode打包命令

    xcodebuild clean -workspace Myproject.xcworkspace -scheme myProject xcodebuild archive -workspace My ...

  7. MVC ScriptBundle自定义排序。

    今天发现MVC的ScriptBundle @Scripts.Render()后是按照我也不知道顺序显示在页面上的,后果就是jquery.min.js被排在了后面(反正我下面那堆默认jquery.min ...

  8. ArcGIS按选定线分割面-案例教程

    ArcGIS按选定线分割面-案例教程 联系方式:谢老师,135-4855-4328,xiexiaokui#qq.com 功能 方法:高级编辑 实例: 分割前后 联系方式:谢老师,135-4855-43 ...

  9. thinkphp5 or

    $where['sq']=[ [ 'like' , '%"'.UID.'"%'] , [ 'like' , '%"'.$userinfo['depart_id'].'&q ...

  10. kafka创建会话,报Error while executing topic command : Replication factor: 1 larger than available brokers: 0.

     bin/kafka-topics.sh --create --zookeeper es1:2181 --replication-factor 1 --partitions 1 --topic top ...