Hi all,
Imagine a scene manager who has a root node with children, so it's a tree.
One way is to iterate the tree using recursivity, but perf is not the best.
An alternative is to use a similare code to a showed code in the wxWidgets documentation :
wxTreeItemId FindItemNamed(wxTreeCtrl &tree, const std::wstring &name)
{
std::stack<wxTreeItemId> items;
if (tree->GetRootItem().IsOk())
items.push(tree->GetRootItem());
while (!items.empty())
{
wxTreeItemId next = items.top();
items.pop();
if (next != tree->GetRootItem() && tree->GetItemText(next) == name)
return next;
wxTreeItemIdValue cookie;
wxTreeItemId nextChild = tree->GetFirstChild(next, cookie);
while (nextChild.IsOk())
{
items.push(nextChild);
nextChild = tree->GetNextSibling(nextChild);
}
}
return wxTreeItemId();
}
Is this method a good way to handle a tree ?
Thanks

Find content
Not Telling