sorting vector of strings in c++ according to index in the string
<p>Hi I have vector of strings,that is the structure of vector : The name of vector is vector</p>

<pre><code>"key:  abc 165.123.34.12", 
"key:  bca 1.1.1.1", 
"key1: bac 3.3.3.3"
</code></pre>

<p>I want to sort the vector according to the second field(abc,bac,bac)</p>

<p>My code is;</p>

<pre><code> bool sort_function(string&amp; str1,string&amp; str2) {

     string nick1,nick2,nick1_ignore,nick2_ignore;

     stringstream ss1(str1) 

     ss1&gt;&gt; nick1_ignore &gt;&gt; nick1;

     stringstream ss2(str2) 

     ss2&gt;&gt; nick2_ignore &gt;&gt; nick2;

     return (nick1&lt;nick2);

 }


     sort(vector.begin(), vector.end(),sort_function);
</code></pre>

<p>But it gives a long error starting with error,</p>

<pre><code>  error: no match for ‘operator&gt;&gt;’ in ‘std::basic_stringstream&lt;char&gt;
</code></pre>

<p>UPDATE:Error is tl_algo.h: In function ‘_RandomAccessIterator std:..</p>

<p>UPDATE:It is fixed. the error is in function declaration I have to use const string</p>
