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
精彩评论