"No matching function call to..." for template function
<p>I am trying to do a binary search template, when I run it using the primitive "int" the code runs fine but when I run it with "string" I get the error</p>

<p>"No matching function call to binary_search_template"</p>

<p>Why does it work with ints but not strings? </p>

<p>Here is the code</p>

<pre><code>main{
 std::vector&lt;string&gt; e;
    e.push_back("a");
    e.push_back("b");
    e.push_back("c");

int index = binary_search_template(e, 0, d.size()-1.0, "a"); //error for strings but not ints

}
</code></pre>

<p>header file</p>

<pre><code>template&lt;typename T&gt;
int binary_search_template(std::vector&lt;T&gt;&amp; a, int from, int to, T value);

template&lt;typename T&gt;
int binary_search_template(std::vector&lt;T&gt;&amp; a, int from, int to, T value)
{
    if (from &gt; to) {
        return -1;
    }
    int mid = (to + from)/2;

    if (a[mid] == value ) {
        return mid;
    }else if (a[mid] &lt; value) {
        return binary_search_template(a, mid+1, to, value);
    }else {
        return binary_search_template(a, from, mid, value);
    }
}
</code></pre>