title: error: lvalue required as left operand of assignment c++
body: <pre><code>template &lt;typename Type&gt;
  bool Lazy_deletion_node&lt;Type&gt;::insert( Type const &amp;obj ) {
      if(this == nullptr){
          Lazy_deletion_node&lt;Type&gt; *tmp = new Lazy_deletion_node( obj );
          this = tmp;
          return true;
      }
      else if(obj == this-&gt;retrieve()){
          if(erased){
              erased = false;
              return true;
          }
          else{
              return false;
          }
      }
      else if(obj &lt; this-&gt;retrieve()){
          left()-&gt;insert( obj );
      } 
      else if(obj &gt; this-&gt;retrieve()){
          right()-&gt;insert( obj );
      }
  }
  </code></pre>
  
  <p>Hey guys, I'm trying to to do an insert for a Lazy deletion tree, which is basically a binary search tree except that I mark the nodes as "erased" instead of actually removing them from the tree. This is a method to insert a new node into the tree containing the object obj. nullptr is defined to be 0.</p>
  
  <p>I first test to see if the pointer is pointing to 0. If it is, I create a node that stores obj inside and then I try to make the pointer point to this newly created node.</p>
  
  <p>However, when I try to compile, it gives me the error that lvalue is required as left operand of assignment on the line that reads this = tmp;. Can anybody tell me why this is happening? </p>
  
  <p>Thanks in advance.</p>