title: Passing a functor into a templated function
body: <p>I am new to templating, but I am trying to make my primms algorithm work with two different distance calculators(thats what the functors are for) based on different constraints for a school project (they calculate the distance differently, one depends on if we care about terrain and the other does not). I declare like this </p>
  
  <pre><code>template &lt;typename func&gt;
      double mst_mode(std::vector&lt;primms_vertex&gt; &amp;mst_vec, const func &amp;comp){
  </code></pre>
  
  <p>But later in the function when I attempt to use it like this: </p>
  
  <pre><code>if(i != working_vertex &amp;&amp; !mst_vec[i].been_visited &amp;&amp; mst_vec[i].distance &gt; comp(mst_vec[working_vertex], mst_vec[i])){
  </code></pre>
  
  <p>I get the following errors :</p>
  
  <p>No matching function for call to object of type 'const primms_vertex::euclids_distance'
  No matching function for call to object of type 'const primms_vertex::primms_distance'</p>
  
  <p>One example of me calling the function is: </p>
  
  <pre><code>poke-&gt;mst_mode(poke-&gt;primms_vector, primms_vertex::primms_distance());
  </code></pre>
  
  <p>(the project is pokemon themed so excuse the funny class name)
  Both of the functors take in the exact same thing, 2 mst_vertex's, which is exactly what I am getting when I index into mst_vec. So I cannot figure out for the life of me what the compiler is complaining about. Any help would be appreciated! </p>