title: sorting std::lists using std::sort
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2432857/sort-list-using-stl-sort-function">Sort list using stl sort function</a><br>
    <a href="https://stackoverflow.com/questions/7996116/why-only-stdlistsort">why only std::list::sort()?</a>  </p>
  </blockquote>
  
  
  
  <p>My question is can we sort two std::lists using std::sort function? I have 2 string lists</p>
  
  <pre><code>  std::list&lt;std::string&gt;list1, list2;
    .....//entering values to list
    std::sort(list1.begin(), list1.end());
  
    std::sort(list2.begin(), list2.end());
  </code></pre>
  
  <p>while i am sorting these lists i am getting error.
  I tried with std::vector, at this time the sort works.</p>
  
  <p>The error is like </p>
  
  <blockquote>
    <p>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(1158) : 
          see declaration of 'std::operator -' 
          1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\algorithm(3642):
          error C2784: '_Base1::difference_type std::operator -
          (const std::_Revranit&lt;_RanIt,_Base> &amp;,const std::_Revranit&lt;_RanIt2,_Base2> &amp;)' :
          could not deduce template argument for 'const std::_Revranit&lt;_RanIt,_Base> &amp;'
          from 'std::_List_iterator&lt;_Mylist>'
            1>          with
            1>          [
            1>              _Mylist=std::_List_val>
            1>          ]</p>
  </blockquote>
  
  <p>I have to know that only std::sort supports lists?</p>