title: Why is max_element not showing the largest string in vector C++?
body: <p>In the code below I attempt to print the largest <code>std::string</code> in a <code>std::vector</code> using <code>std::max_element</code>.</p>
  <p>I expected the output of the code below to be:</p>
  <pre><code>Harmlessness
  </code></pre>
  <p>The actual output I got is:</p>
  <pre><code>This
  </code></pre>
  <p><strong>The code:</strong></p>
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;
  #include &lt;algorithm&gt;
  #include &lt;vector&gt;
  using namespace std;
  int main(){
      vector &lt;string&gt; strlist;
      strlist.push_back(&quot;This&quot;);
      strlist.push_back(&quot;Harmless&quot;);
      strlist.push_back(&quot;Harmlessness&quot;);
      cout &lt;&lt; *max_element(strlist.begin(), strlist.end());
      return 0;
  }
  </code></pre>
  <p><strong>My question:</strong><br />
  Can you explain why the code produced the actual output above and not the one I expected ?</p>