title: C++, g++ compiling error function
body: <p>I can't make this work, it does not get compiled, I don't know where is the mistake. Can you help me?</p>
  
  <p>I am creating a program that sorts a vector of "n" int numbers.</p>
  
  <p>This is the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  
  using namespace std;
  
  
  void selection_sort(vector &lt;int&gt;&amp; v){
  
    int last=v.size() -1;
  
    for(int i=0; i&lt;last; ++i){
  
      int k = min(v, i, last);
  
      //Vector, position "i", and last vector position send to function
  
  
      swap(v[k],v[i]);//swap positions
  
    }
  
  
  }
  
  
  
  int min(const vector &lt;int&gt;&amp; v, int left, int right){
  </code></pre>
  
  <p>And this is the error from the terminal:</p>
  
  <pre><code>g++ -o sortinglearn.x sortinglearn.cc
  sortinglearn.cc: In function ‘void selection_sort(std::vector&lt;int&gt;&amp;)’:
  sortinglearn.cc:14:27: error: no matching function for call to   
  ‘min(std::vector&lt;int&gt;&amp;, int&amp;, int&amp;)’
       int k = min(v, i, last);
                             ^
  In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                   from /usr/include/c++/7/ios:40,
                   from /usr/include/c++/7/ostream:38,
                   from /usr/include/c++/7/iostream:39,
                   from sortinglearn.cc:1:
  /usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate:    
  template&lt;class _Tp&gt; constexpr const _Tp&amp; std::min(const _Tp&amp;, const _Tp&amp;)
       min(const _Tp&amp; __a, const _Tp&amp; __b)
       ^~~
  /usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument   
  deduction/substitution failed:
  sortinglearn.cc:14:27: note:   deduced conflicting types for parameter      
  ‘const _Tp’ (‘std::vector&lt;int&gt;’ and ‘int’)
       int k = min(v, i, last);
  </code></pre>