title: Extract column from matrix in C++
body: <p>I would like to extract a column from a matrix class which has variable <code>A</code> implemented as a <code>&lt;vector&lt;vector&lt;T&gt; &gt;</code> like this <code>my_matrix(,2)</code> and that should extract my second column. Also I don't want a function name get_col because I already used operator() overloading to extract rows. I tried:</p>
  
  <pre><code>template&lt;class T&gt;
  vector&lt;T&gt; &amp; operator()(void, const int&amp; col){
      vector&lt;T&gt; Result(rows,0);
      for(int i=0;i&lt;rows;++i)
          Result[i]=this-&gt;A[i][col];
      return Result;
  }
  </code></pre>
  
  <p>any suggestions?</p>
  
  <p>The class consists of:</p>
  
  <pre><code>template &lt;class T&gt; class QMatrix{
  public:
      int rows; 
      int cols;
      vector&lt;vector&lt;T&gt; &gt; A;
  </code></pre>