title: Template function gives "no matching function for call" error
body: <p>First question on stackoverflow :) I'm relatively new to C++, and have never used templates, so forgive me if I'm doing something silly. I have a template function that combs through a list and checks for a specified element of a general type. That way I can specify whether it's looking for a string, or an int, or whatever.</p>
  
  <pre><code>template &lt;class T&gt;   
  bool inList(T match, std::string list)  
  {
      int listlen = sizeof(list);
      for (int i = 0; i &lt;= listlen; i++) {
          if (list[i] == match) return true;
          else continue;
      }
      return false;
  };
  </code></pre>
  
  <p>This is my call to <code>inList()</code>. <code>testvec</code> is a string vector with a few elements, including "test":</p>
  
  <pre><code>if (inList&lt;string&gt;("test", testvec))
      cout &lt;&lt; "success!";
  else cout &lt;&lt; "fail :(";
  </code></pre>
  
  <p>To my dismay and confusion, upon compiling, I am slapped with the following error:</p>
  
  <pre><code>error: no matching function for call to 'inList(const char [5], std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;)'
  </code></pre>
  
  <p>What am I doing incorrectly? :(</p>
  
  <p>[EDIT]
  I neglected to mention that the template definition is in the global namespace. (it's a simple test program to see if my template will work, and it does not, apparently :( )</p>