title: How do I dereference the return value of a function returning a pointer without using a temporary variable?
body: <p>C++ noob here. </p>
  
  <p>So, this is a member function of my <code>class DbHelper</code>:</p>
  
  <pre><code>QSqlQueryModel* getCourses();
  </code></pre>
  
  <p>Now, whenever I do this in <code>class MyModel</code> where <code>QSqlQueryModel courses</code> is a member:</p>
  
  <pre><code>this-&gt;courses = *(dbHelper-&gt;getCourses()); // problem here ... this is inside a member function of MyModel
  </code></pre>
  
  <p>Visual Studio says that </p>
  
  <blockquote>
    <p>function ... operator= cannot be referenced ... it is a deleted
    function</p>
  </blockquote>
  
  <p>Of course I can do this instead:</p>
  
  <pre><code>QSqlQueryModel* q = dbHelper-&gt;getCourses();
  this-&gt;courses = *q;
  </code></pre>
  
  <p>But I'm thinking that declaring another variable just to dereference it is possibly redundant. So is there a shorter way?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Just verified it with VS and it turned out I really can't. My mind really just got messed up in studying pointers and references the entire afternoon. Thanks people.</p>