开发者

Using a STL container to store Treeview data

开发者 https://www.devze.com 2022-12-17 00:44 出处:网络
i\'m looking for a C++ STL contai开发者_Python百科ner class to keep the treeview parent/child node strings butwhen a node is deleted from tree control, do i have iterate through all the container clas

i'm looking for a C++ STL contai开发者_Python百科ner class to keep the treeview parent/child node strings but when a node is deleted from tree control, do i have iterate through all the container class elements to find that selected one and then delete it? what's the best to keep the data updated in container?


use STL set, which is efficient in operations like insert and delete in O(log n) time.

e.g.

set<TreeNode> a;
a.insert(aTreeNode); // insert
a.erase(aTreeNode); // delete
0

精彩评论

暂无评论...
验证码 换一张
取 消