tags:

views:

54

answers:

1

i'm looking for a C++ STL container 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?

+7  A: 

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
Yin Zhu