Now that you have smart pointer, you can use it do the memory management and take raw pointers from them to use in STL containers. In that way you keep the ownership out of the container.
Here I have a unique_ptr of a tree, but used STL stack to store the raw pointers
void TreeTraversal(unique_ptr& root) {
stack _stack;
BinaryTreeNode *p = root.get();
_stack.push(p);
while(!_stack.empty()) {
p = _stack.top();
_stack.pop();
...
_stack.push(p->left);
_stack.push(p->right);
}
}
int main() {
unique_ptr root = unique_ptr(new BinaryTreeNode(...));
TreeTraversal(root);
}