title: How to force the call to move constructor and why should I do that?
body: <p>I tested this code to see that the compiler automatically transfers temporary object to variables without needing a move constructor. </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  class A
  {
      public:
      A()
      {
          cout&lt;&lt;"Hi from default\n";
      }
  
      A(A &amp;&amp; obj)
      {
          cout&lt;&lt;"Hi from move\n";
      } 
  };
  
  A getA()
  {
      A obj;
      cout&lt;&lt;"from getA\n";
      return obj;
  }
  
  int main()
  {
      A b(getA());
  
     return 0;
  } 
  </code></pre>
  
  <p>This code prints "Hi from default from getA" and not the presumed "Hi from move"</p>
  
  <p>In optimization terms, it's great. But, how to force the call to the move constructor without adding a copy? (if I wanted a specific behavior for my temporary objects)</p>
  
  <p>Complementary question: I though that if I did not write a move constructor there would be a copy each time I would assign a rvalue to a lvalue (like in this code at the line <code>A b(getA());</code>). Since it's not the case and the compiler seems to do well, when is it really useful to implement the move semantics?</p>