title: Unique Pointer attempting to reference a deleted function
body: <p>Hello I am trying to use pointers and learning the basics on unique pointers in <code>C++</code>. Below is my code I have commented the line of code in main function. to debug the problem However, I am unable to do so. What am I missing ? Is my <code>move()</code> in the <code>insertNode()</code> incorrect ? The error I get is below the code :</p>
  
  <pre><code>#include&lt;memory&gt;
  #include&lt;iostream&gt;
  
  struct node{
      int data;
      std::unique_ptr&lt;node&gt; next;
  };
  
  
  void print(std::unique_ptr&lt;node&gt;head){
          while (head)
              std::cout &lt;&lt; head-&gt;data&lt;&lt;std::endl;
      }
  
  
  std::unique_ptr&lt;node&gt; insertNode(std::unique_ptr&lt;node&gt;head, int value){
          node newNode;
          newNode.data = value;
          //head is empty
          if (!head){
              return std::make_unique&lt;node&gt;(newNode);
          }
          else{
              //head points to an existing list
              newNode.next = move(head-&gt;next);
              return std::make_unique&lt;node&gt;(newNode);
          }
      }
  
  
  
  auto main() -&gt; int
  {
      //std::unique_ptr&lt;node&gt;head;
      //for (int i = 1; i &lt; 10; i++){
      //  //head = insertNode(head, i);
      //}
  }
  </code></pre>
  
  <p><strong>ERROR</strong>
  std::unique_ptr>::unique_ptr(const std::unique_ptr&lt;_Ty,std::default_delete&lt;_Ty>> &amp;)' : attempting to reference a deleted function</p>