Need help on this C++ code
<p>I'm beginner programmer and trying to get this code work:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
using namespace std;
template &lt;typename T&gt;
T min(vector&lt;T&gt;vec) {
    T x=vec[0];
    int index;
    for (int i=0; i&lt;vec.size(); i++) {
        if (vec[i]&lt;x) { x=vec[i]; index=i; }
    }
    return index;
}
template &lt;typename T&gt;
void printVec (vector&lt;T&gt;v) {
    for (int i=0; i&lt;v.size(); i++) 
        cout&lt;&lt;v[i]&lt;&lt;endl; 
}
template &lt;typename T&gt;
void selectSort(vector&lt;T&gt;&amp;first) {
vector&lt;T&gt;second;
while(first.size()!=0) {
    second.push_back(first[min(first)]);
    first.erase(first.begin()+min(first));
  }
      first=second;
}


int main() {
    int Mas[] = { 7, 15, 14, 12, 99, 180, 197, 567, 123, -101, 32, 144, 156, 177, 4, -17, -88, 18, 99, 143, -90 };
    int dim = sizeof(Mas)/sizeof(int);
    vector&lt;int&gt;v (&amp;Mas[0], &amp;Mas[dim]);
    int m=min(v);
    selectSort(v);
    printVec(v);

    cin.get();
    return 0; }
</code></pre>

<p>for some reason, </p>

<pre><code>    while(first.size()!=0) {
</code></pre>

<p>loop doesn't seem to work.
Can someone help? 
Sorry for my bad English.</p>
