title: How does std::sort work for list of pairs?
body: <p>Why does <a href="http://ideone.com/tkYavT" rel="noreferrer">this</a>:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;                                                             
  #include &lt;algorithm&gt;
  
  using namespace std;
  
  vector&lt;pair&lt;int, string&gt;&gt; list;
  
  int main() {
      int one = 1, two = 2, three =3, five =5, six = 6;
      string bla = "bla";
  
      list.push_back( pair&lt;int, string&gt;(two, bla));
      list.push_back( pair&lt;int, string&gt;(one, bla));
      list.push_back( pair&lt;int, string&gt;(two, bla));
      list.push_back( pair&lt;int, string&gt;(six, bla));
      list.push_back( pair&lt;int, string&gt;(five, bla));
  
      sort(list.begin(), list.end());
  
      for(auto item : list) {
          cout &lt;&lt; item.first &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>work as intended? output is:</p>
  
  <pre><code>1
  2
  2
  5
  6
  </code></pre>
  
  <p>How <code>std::sort</code> gets how to sort my <code>int-string</code> pairs? How to make it do so for some class of mine as pair <code>first</code>? Is there a way to sort by <code>second</code> using <code>std::sort</code>?</p>