title: How come the move constructor isnt called in my code?
body: <pre><code>#include &lt;iostream&gt;
  #include&lt;algorithm&gt;
  
  template&lt;class T&gt;
  class Matrix {
      std::pair&lt;unsigned int,unsigned int&gt; dim;
      T* elem;
  public:
      Matrix(unsigned int d1, unsigned int d2) :
          dim{std::make_pair(d1,d2)}, elem{new T[d1*d2]} { }
  
      unsigned int size() const { return (dim.first)*(dim.second); }
  
      Matrix(Matrix&amp;&amp; a){
          std::cout&lt;&lt;"move constructor";
          elem = a.elem;
          a.elem =nullptr;
          dim.first = a.dim.first+7;
          dim.second = a.dim.second;
          a.dim.first=0;
          a.dim.second=0;
      }
  
      Matrix&amp; operator=(Matrix&amp;&amp; a){
          std::cout&lt;&lt;"move operator=";
          elem = a.elem;
          a.elem =nullptr;
          dim.first = a.dim.first;
          dim.second = a.dim.second;
          a.dim.first=0;
          a.dim.second=0;
          return *this;
      }
  
      ~Matrix() { delete[] elem; }
  };
  
  using namespace std;
  
  int main() {
      Matrix&lt;unsigned int&gt; bob = Matrix&lt;unsigned int&gt;(5,5);
      Matrix&lt;unsigned int&gt; bob2(Matrix&lt;unsigned int&gt;(5,5));
      return 0;
  }//no output
  </code></pre>
  
  <p>I'm expecting it to print "move constructor" and "move operator="
  But it prints neither of them.</p>
  
  <p>Matrix(5,5) doesnt have a name so i assume its rvalue, thus im expecting <code>Matrix&lt;unsigned int&gt; bob = Matrix&lt;unsigned int&gt;(5,5);</code> to call the move constructor</p>