title: std::sort on an std::vector compares but never replaces
body: <p>the array stays the same after the sort. How is that possible? I can see the healthy comparison result.</p>
  
  <p>There's a model class that owns a std::vector:</p>
  
  <pre><code>private:
       std::vector&lt;Contact&gt; contacts;
  </code></pre>
  
  <p>The class contact has:</p>
  
  <ol>
  <li>QString private member</li>
  <li>QString private member getter - GetName()</li>
  <li>Copy constructor that handles the members</li>
  <li>Assignment operator that handles the members</li>
  <li>&lt; operator defined as follows:</li>
  </ol>
  
  <hr>
  
  <pre><code>bool Contact::operator &lt; (const Contact&amp; contact) const {
      QString str1 = contact.GetName();
      QString str2 = this-&gt;GetName();
      bool b = (QString::compare(str1,str2) &lt; 0);
      return b;
  }
  </code></pre>
  
  <p>I am debugging this method during sort, and i find that the correct "b" is returned, every time. The names are retrieved correctly, are compared correctly, and the "b" return code is always correct.</p>
  
  <p>In the class that owns the vector, I have a sort method...</p>
  
  <pre><code>void ContactsModel::sort ()
  {
      qDebug("Before Sorting: size: %d", this-&gt;contacts.size());
  
      for (int i=0; i&lt; this-&gt;contacts.size(); i++)
      {
      QString str = contacts[i].GetName();
      qDebug(str.toAscii());
      }
  
      // trying to sort...
      std::sort(this-&gt;contacts.begin(), this-&gt;contacts.end());
  
      // PROBLEM: Output here is identical to what I had before the sort. The vector is not sorted, not even close. It's 52 random names in the same order they were initially put in the vector.
  
      qDebug("After Sorting: size: %d", this-&gt;contacts.size());
      for (int i=0; i&lt; this-&gt;contacts.size(); i++)
      {
      QString str = contacts[i].GetName();
      qDebug(str.toAscii());
      }
  }
  </code></pre>