I was recently introduced to the existence of auto_ptr
and shared_ptr
and I have a pretty simple/naive question.
I try to implement a data structure and I need to point to the children of a Node
which (are more than 1 and its) number may change. Which is the best alternative and why:
class Node
{
public:
// ...
Node *children;
private:
//...
}
class Node
{
public:
// ...
share_ptr<Node> children;
private:
//...
}
I am not sure, but I think auto_ptr
does not work for arrays. I am not, also, sure about whether I should use double pointers. Thanks for any help.