title: How to force a move out of a member of a temporary in a function in its return?
body: <p>I have a holder class SqlContext for a result type of DiagnosticSQLResult like here:</p>
  <pre><code>template &lt;typename T&gt;
  struct DiagnosticSQLResult
  {
      bool success = true;
      string sqlError;
      T data;
  };
  
  
  DiagnosticSQLResult&lt;ComplexType&gt; GetSomeValue(SqlDatabase db)
  {
      SqlContext&lt;ComplexType&gt; ctx(db, &quot;sql query here&quot;);
      ctx.ForEachInSelect([&amp;](SqlQuery&amp; q){
          // code initializing result variable here
      });
      return ctx.result;
  }
  </code></pre>
  <p>I would like to move out the ctx.result variable instead of copy constructing another instance when returning from a function. Is that possible somehow? As far as I understand, I can't just call std::move on it because it will be a dangling reference outside...</p>