title: Append column to matrix, using Eigen library
body: <p>It's quite a simple task, but I was not able to find an answer to it:</p>
  
  <p>Using the Eigen library, suppose I have <code>Matrix2Xd mat</code> and <code>Vector2d vec</code>, where</p>
  
  <pre><code>mat = 1 1 1
        1 1 1
  vec = 2 2
  </code></pre>
  
  <p>Now I need something like <code>mat.addCol(vec)</code> such that afterwards</p>
  
  <pre><code>mat = 1 1 1 2
        1 1 1 2
  </code></pre>
  
  <p>What is the best (simplest) way to accomplish this?</p>
  
  <p>Please note, that this is not a duplicate of <a href="https://stackoverflow.com/questions/16470893/how-do-you-make-a-matrix-out-of-vectors-in-eigen">How do you make a matrix out of vectors in eigen?</a>. I don't want to initialy construct the matrix but append to an existing one. Or is there maybe a trick, how to use the comma initialization in this case? The following code will fail:</p>
  
  <pre><code>Matrix2Xd mat(2,3);
  Vector2d vec;
  mat &lt;&lt; 1, 1, 1, 1, 1, 1;
  vec &lt;&lt; 2, 2;
  
  cout &lt;&lt; mat &lt;&lt; endl;
  mat &lt;&lt; vec;             // &lt;-- crashes here
  cout &lt;&lt; mat &lt;&lt; endl;
  </code></pre>
  
  <hr>
  
  <p><strong>Edit:</strong> The following works, but I don't like the need of a temporary variable for such a basic task. Is there a better way?</p>
  
  <pre><code>Matrix2Xd tmp(2, mat.cols()+1);
  tmp &lt;&lt; mat, vec;
  mat = tmp;
  </code></pre>