欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

An STL like Tree Class

系統 1664 0
Is your email address OK? You are signed up for our newsletters but your email address is either unconfirmed, or has not been reconfirmed in a long time. Please click here to have a confirmation email sent so we can confirm your email address and start sending you newsletters again.
<!-- Main Page Contents Start --><!-- Article Starts -->

Sample Image

Introduction

For more than a year and a half I have had to use some kind of multi-node tree to do something. However, all I found from the Internet are binary trees or equivalents. I therefore decided to write my own. Because I had to finish it pretty fast, I spent only two days for it, so it may be buggy.

In the project, it has three classes working like in STL container-iterator style.
Collapse Copy Code
      
        template
      
      
        <
      
      
        class
      
       Key, 
      
        class
      
       T
      
        >
      
      
        class
      
       Tree

      
        template
      
      
        <
      
      
        class
      
       Key, 
      
        class
      
       T
      
        >
      
      
        class
      
       Tree_iterator

      
        template
      
      
        <
      
      
        class
      
       Key, 
      
        class
      
       T
      
        >
      
      
        class
      
       TreeNode
    

A tree contains many tree nodes, while tree nodes contain data. Tree nodes of a tree are called children. In the design each node is assigned a level and the root node is of level 1. Tree_iterator is for navigation within the tree. Two tree-walk styles are defined. One walks down from the root node, while the other one use post-style to walk through all children of the tree. For each walk action, a tree_iterator is returned, so the user can use the iterator to reference the tree node and get the data.

I wrapped all the classes under the namespace Tiffany. For example, declaration of the tree with key type of wstring , and node data type of string, and add two levels of element is like:

Collapse Copy Code
      Tiffany::Tree
      
        <
      
      wstring, 
      
        string
      
      
        >
      
       x(L
      
        "
      
      
        Node 1"
      
      , 
      
        "
      
      
        Root"
      
      );

px = x.AddChild(L
      
        "
      
      
        Key1"
      
      ,
      
        "
      
      
        A"
      
      );
px1 = x.AddChild(px, L
      
        "
      
      
        Key2"
      
      , 
      
        "
      
      
        1"
      
      );

    

For a walk down action, you can limit it to a part of a tree ("sub-tree") by using the function SetSubTreePivot(px) , and you can set the pivot to point back to the root node by calling SetWalkDownRootPivot. Try it out!. You can even delete part of the tree by calling DelSubTree() .

Unfortunately I didn't have much time to prepare this document, but it should be obvious how to the classes.

<!-- Main Page Contents End -->

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

An STL like Tree Class


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 国产精品夜夜春夜夜爽久久 | 91精品国产免费久久 | jizz性欧美2| 亚州 色毛片免费观看 | 色插综合 | 精品96久久久久久中文字幕无 | 欧美日韩一区二区在线视频 | 日本人与黑人xxxx | 青青草在线免费视频 | 精品国产乱码久久久久久88av | 日本亚洲成人 | 日本黄色大片免费看 | 天天在线欧美精品免费看 | 日本黄色片一级片 | 男女性爽大片在线观看 | 日本久久久久中文字幕 | 欧美综合自拍亚洲综合网 | 日韩黄色影视 | 一区二区三区高清视频在线观看 | 日本一级成人毛片免费观看 | 亚洲阿v天堂2021在线观看 | 奇米影视图片 | 色黄网站在线观看 | 精品亚洲国产成av人片传媒 | 国产v视频 | 日日日bbb | 精品国产一区二区三区久久久 | 日本高清色视频www 99视频在线 | 精品极品三级久久久久 | 国产精品久久久久久久久久久搜索 | 亚洲A片V一区二区三区有声 | 91精品国产综合久久福利软件 | 99热久久精品免费精品 | 亚洲人和日本人jizz | 欧美国产精品一区二区 | 日本一级特黄a大片在线 | 韩国精品一区二区 | 毛片毛片毛片毛片毛片毛片 | 亚洲欧美视频一区 | 午夜理论电影在线观看亚洲 | 视频在线观看一区二区 |