title: C++ Will copy elision happen when returning a temporary object
body: <p>If I understand correctly copy elision will happen if an object is returned like this:</p>
  
  <pre><code>CSomeObject getObject(){
  
      //....
      //....
      return CSomeObject(...);
  }
  </code></pre>
  
  <p>Is it safe to assume that copy elision will also happen here:</p>
  
  <pre><code>CSomeObject getObject(){
  
      CSomeObject some_object;
      some_object.setStuff();
      some_object.setMoreStuff();
      //....
      //....
      return some_object;
  }
  
  CSomeObject some_object = getObject();
  </code></pre>
  
  <p>There is only one return statement and always the same temporary object is returned. What about when the return is delegated / indirect:</p>
  
  <pre><code>CSomeObject getObject_2(){
      //....
      return getObject();
  }
  
  CSomeObject some_object = getObject_2();
  </code></pre>