title: Overload Eigen::MatrixBase<T>
body: <p>I have a function for which I have several templated overloads. I which to add an Eigen overload to it. I want to be general such as to be able to accept any Eigen matrix. Therefore I use <code>Eigen::MatrixBase&lt;T&gt;</code>. The problem kicks in with the overload, where the compiler fails to recognise the closest match with <code>Eigen::MatrixBase&lt;T&gt;</code>. Here is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;Eigen/Eigen&gt;
  
  template &lt;class T&gt;
  void foo(const Eigen::MatrixBase&lt;T&gt; &amp;data)
  {
    std::cout &lt;&lt; "Eigen" &lt;&lt; std::endl;
  }
  
  // ... several other overloads
  
  template &lt;class T&gt;
  void foo(const T &amp;data)
  {
    std::cout &lt;&lt; "other" &lt;&lt; std::endl;
  }
  
  int main()
  {
    Eigen::VectorXd a(2);
  
    a(0) = 0.;
    a(1) = 1.;
  
    foo(a);
  }
  </code></pre>
  
  <p>Whereby the output is <code>other</code>. How can I make the Eigen overload such that it is the closest match for any Eigen matrix?</p>