title: vector template - 'no match for call' error
body: <p>I am trying to use templates along with vector in my code the following way:</p>
  
  <p>In my header file:</p>
  
  <pre><code>template &lt;typename V&gt;
  void changeConfig(char option, vector &lt;V&gt; &amp; arg_in){
          // ....
    }
  </code></pre>
  
  <p>In the source file:</p>
  
  <pre><code>vector &lt;int&gt; p = {4};
  changeConfig('w' ,p);
  </code></pre>
  
  <p>And this's the error that I get:</p>
  
  <p>/include/config.h: In member function ‘void Cfconfig::changeConfig(char, std::vector&lt;_RealType>&amp;) [with V = int]’:</p>
  
  <p>src/config_test.cpp:10:38:   instantiated from here</p>
  
  <p>/include/config.h:68:25: error: no match for call to ‘(int_vector {aka std::vector}) (std::vector&amp;)’</p>
  
  <p>make: *** [featureconfig_test.o_dbg] Error 1</p>
  
  <p>I tried the suggestions on this thread but none of them seem to work.</p>
  
  <p><a href="https://stackoverflow.com/questions/11052644/c-templates-error-no-matching-function-for-call">C++ Templates Error: no matching function for call</a></p>
  
  <p>Any help would be appreciated. Thanks.</p>
  
  <p>Okay, I made a short snippet of my code which gives the same error:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdarg.h&gt;
  #include &lt;cstdio&gt;
  #include &lt;opencv2/opencv.hpp&gt;
  #include &lt;string.h&gt;
  #include &lt;math.h&gt;
  #include &lt;complex.h&gt;
  #include &lt;dirent.h&gt;
  #include &lt;fstream&gt;
  #include &lt;typeinfo&gt; 
  #include &lt;unistd.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;algorithm&gt;
  #include &lt;array&gt;
  #include &lt;initializer_list&gt;
  #include &lt;vector&gt;
  #include &lt;algorithm&gt;
  
  
  using namespace std;
  
  
  template &lt;typename V&gt;
  void changeConfig(char option, vector &lt;V&gt; &amp; arg_in){
  
       vector&lt;int&gt; window = {5};
       vector&lt;double&gt; scale = {3};
  
              switch(option){
                      case 'w':                                        
                              window(arg_in);
                              break;
                      case 's':
                              scale(arg_in);
                              break;
              } 
  
      }
  
  
  int main(){
  
      vector &lt;int&gt; p = {3};
      changeConfig&lt;int&gt;('w', p);
  
      return 0;
  
  }
  </code></pre>
  
  <hr>
  
  <p>I compiled using :
     g++ -std=c++0x test_template.cpp -o test </p>
  
  <p>which gave me this error:</p>
  
  <p>test_template.cpp: In function ‘void changeConfig(char, std::vector&lt;_RealType>&amp;) [with V = int]’:</p>
  
  <p>test_template.cpp:45:33:   instantiated from here</p>
  
  <p>test_template.cpp:32:33: error: no match for call to ‘(std::vector) (std::vector&amp;)’</p>
  
  <p>test_template.cpp:35:33: error: no match for call to ‘(std::vector) (std::vector&amp;)’</p>