title: Why can't I assign matrix_exp from dlib to std::vector?
body: <p>I am using Dlib thanks to its great matrix sub module. I find it very complete and useful to do fast scientific algorithm. I managed to add some custom operations and get the overall idea how it works. </p>
  
  <p>However, there is a question that bother me since quite some time. Is there specific reason why it seems impossible to assign any kind of matrix expression to an <code>std::vector</code> ?</p>
  
  <p>EDIT:</p>
  
  <p>Here is a typical dlib function:</p>
  
  <pre><code>template &lt;typename EXP&gt;
  const matrix_op&lt;op_trans&lt;EXP&gt; &gt; trans(const matrix_exp&lt;EXP&gt;&amp; m) {
    typedef op_trans&lt;EXP&gt; op;
    return matrix_op&lt;op&gt;(op(m.ref());
  }
  </code></pre>
  
  <p>And if I want to implement the corresponding function that takes and returns <code>std::vector</code> instead, I think I would do:</p>
  
  <pre><code>template &lt;typename EXP&gt;
  const std::vector&lt;matrix_op&lt;op_trans&lt;EXP&gt; &gt; &gt; trans(const std::vector&lt;matrix_exp&lt;EXP&gt; &gt;&amp; ms) {
    std::vector&lt;matrix_op&lt;op_trans&lt;EXP&gt; &gt; &gt; out(ms.size());
    typedef op_resize_bilinear&lt;EXP&gt; op;
    for (int i = 0; i &lt; ms.size(); ++i)
      out[i] = matrix_op&lt;op&gt;(op(ms.ref()));
    return out;
  }
  </code></pre>
  
  <p>But as it works, any expression is seen as <code>matrix_exp</code> being <code>matrix</code>, <code>matrix_op</code>, <code>matrix_add_exp</code>... But this is not true with <code>std::vector&lt;matrix_exp&gt;</code>:</p>
  
  <p><code>‘const std::vector&lt;smu::matrix&lt;float&gt; &gt;’ is not derived from ‘const std::vector&lt;smu::matrix_exp&lt;EXP&gt; &gt;’</code></p>
  
  <p>I just want to know if this is intentional from dlib, if there are any reason for it as it could be useful in several algorithms that need to process several matrices at once... and if some work around this could work</p>