title: Template issue causes linker error (C++)
body: <p>I have very little idea what's going in regards to C++ templates, but I'm trying to implement a function that searches a vector for an element satisfying a given property (in this case, searching for one with the name given). My declaration in my .h file is as follows:</p>
  
  <pre><code>template &lt;typename T&gt;
  T* find_name(std::vector&lt;T*&gt; v, std::string name);
  </code></pre>
  
  <p>When I compile, I get this linker error when I call the function:</p>
  
  <pre><code>Error   1   error LNK2019: unresolved external symbol "class Item * __cdecl find_name&lt;class Item&gt;(class std::vector&lt;class Item *,class std::allocator&lt;class Item *&gt; &gt;,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;)" (??$find_name@VItem@@@@YAPAVItem@@V?$vector@PAVItem@@V?$allocator@PAVItem@@@std@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z) referenced in function "public: class Item * __thiscall Place::get_item(class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;)" (?get_item@Place@@QAEPAVItem@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) place.obj   Program2
  </code></pre>
  
  <p>Again, I'm new to templates so I don't know what's going. All instances I've found of LNK2019 through Google have been about not using the correct libraries, but since this is my own function I don't see why this would be happening.</p>
  
  <p>Also, a related question: Is there a way to make a template parameter so that it has to be a subclass of a certain class, i.e. template?</p>