title: When shared_ptr, when unique_ptr
body: <p>When should I use shared_ptr and when unique_ptr?</p>
  
  <p>For example in this class instead of node* should be shared_ptr or unique_ptr. What it depends on?</p>
  
  <pre><code>class node
  {
  private:
      node *parent;
      vector&lt;node*&gt; children;
  
      /*
       * txny
       * x - numer drzewa
       * y - numer wezla
       */
      string id;
      typeNode type; //0 - term, 1 - func
  
  public:
      node(node* parent, string id, typeNode type);
      virtual ~node() {}
  
      void addChild(node* child);
      void setChildren(vector&lt;node*&gt; &amp;children);
      node* getChild(int i);
      int getChildrenNumber();
      void setParent(node* parent);
      node* getParent();
      string getId();
      typeNode getType();
      void setId(string id);
  }; 
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>Class tree owns node object. I must write more text cause cant save changes.</p>
  
  <pre><code>class tree
  {
  private:
      vector &lt;node*&gt; nodes;
      int depth;
      int counterNodes;
      /*
       * pxty
       * x - numer populacji (generacji)
       * y - numer drzewa
       */
      string id;
  private:
      node* root;
      node* parentGeneticPoint;
  public:
      tree(int depth, string id);
      tree(int depth);
      ~tree();
  public:
      void initialize(typeInit type);
      void showVector();
      void show();
      Mat run();
      tree* copy();
      tree* copySubtree(int subrootI);
      tree* copyWithoutSubtree(int subrootI);
  </code></pre>
  
  <p>};</p>