title: Eigen::Ref in pass-by-pointer
body: <p>Similar to question <a href="https://stackoverflow.com/questions/17030332/pointer-vs-reference-difference-when-passing-eigen-objects-as-arguments">Pointer vs Reference difference when passing Eigen objects as arguments</a></p>
  
  <p>Let's say we have foo1 and matrix mat2by2:</p>
  
  <pre><code>void foo1(MatrixXd&amp; container){
      //...container matrix is modified here
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>Matrix33d mat2by2;
  mat2by2 &lt;&lt; 1,2,
             3,4;
  </code></pre>
  
  <p>After reading <a href="http://eigen.tuxfamily.org/dox/TopicFunctionTakingEigenTypes.html" rel="nofollow noreferrer">http://eigen.tuxfamily.org/dox/TopicFunctionTakingEigenTypes.html</a>, it seems like a better alternative to foo1 may be:</p>
  
  <pre><code>void foo2(Ref&lt;MatrixXd&gt; container){
      //...container matrix is modified here
  }
  </code></pre>
  
  <p>If foo2's parameter is being passed as a reference, 
  what would be the equivalent to pass-by-pointer using the Eigen::Ref class??</p>
  
  <pre><code>void foo(Eigen::MatrixXd* container){
      //...container matrix is modified here
  }
  </code></pre>