title: copy constructor for two dimensional vector
body: <p>I want to write a copy constructor for two dimensional vector </p>
  
  <p>relevant code:</p>
  
  <pre><code>MyMatrix :: MyMatrix(const MyMatrix &amp; mat)       // Copy Constructor
  {
      m_m = mat.m_m;
      m_n = mat.m_n;
      vector &lt; vector &lt;int&gt; &gt; m_matrix(m_n, std::vector&lt;int&gt;(m_m,0));
  
      for( int i=0;i&lt;m_n ; i++)
      {
          for( int j=0; j&lt;m_m ;j++)
          {
              m_matrix[i][j] = mat.m_matrix[i][j];
          }
      }
  }
  </code></pre>
  
  <p>but it doesn't work and I don't find the error. What's wrong in this code?</p>
  
  <pre><code>class MyMatrix
  {
   public:            // Methods
  
      MyMatrix();
      MyMatrix(int n, int m);
      MyMatrix(int n, int m, std:: vector &lt;std:: vector &lt;int&gt; &gt; matrix );
      MyMatrix(const MyMatrix &amp; mat) ;
      ~MyMatrix();        
  
    private:          // Attributes
  
      int m_n;
      int m_m;
  
      std:: vector &lt;std:: vector &lt;int&gt; &gt; m_matrix;
  
  };
  </code></pre>