title: why sort function of STL is not working?
body: <p>A set of numbers will be passed as input. Also the redefined relationship of the digits 0-9 in ascending order will be passed as input. Based on the redefined relationship, the set of numbers must be listed in ascending order.
  Sample I/O</p>
  
  <p>Input:</p>
  
  <pre><code>20 50 11 121
  
  9231476058
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>50 11 20 121
  </code></pre>
  
  <p>The program which i wrote having an error about which i am not aware of. so, please help me in debugging it. </p>
  
  <p>Program specification:</p>
  
  <p>1.) I created one adjacency list for grouping the numbers on the basis of their     number of digits(50 11 20 grouped at index 2 and 121 at index 3)</p>
  
  <p>2.)For sorting them i have used standard template library sort function. I have passed the following parameters </p>
  
  <pre><code>list&lt;int&gt; *lst=new list&lt;int&gt;[10];       //adjacency list
  
  void sortg(list&lt;int&gt; *lst,int *arr1)
  {
      static int *arr=arr1;
      struct fnct
      {
          int digi;
  
          fnct(int digi)
          {
              this-&gt;digi=digi;
          }
          bool operator()(int val1,int val2)
          {
              while(digi&gt;0)  // is the number of digits of the passed arguments
              {
                  //logic for sorting. here i have used local arry "*arr" which i
                  //have declared static
              }
          }
      };
  
      for(int con=9;con&gt;=0;--con)      //count for the rows of adjacency list
      {
          if( (*(lst+con)).size()&gt;0 )     // for finding out a valid list
          {
              sort((lst+con)-&gt;begin(),(lst+con)-&gt;end(),fnct(con));
  
          }
      }
  }
  </code></pre>
  
  <p>The error which i got is:</p>
  
  <pre><code>In file included from /usr/include/c++/4.9/algorithm:62:0,from prog.cpp:5:
  /usr/include/c++/4.9/bits/stl_algo.h: In instantiation of 'void
  std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with
  _RandomAccessIterator = std::_List_iterator&lt;int&gt;; _Compare =                  
  __gnu_cxx::__ops::_Iter_comp_iter&lt;sortg(std::list&lt;int&gt;*, int*)::fnct&gt;]':
  /usr/include/c++/4.9/bits/stl_algo.h:4716:78:   required from 'void              
  
  std::sort(_RAIter, _RAIter, _Compare) [with _RAIter =   
  
  std::_List_iterator&lt;int&gt;;    _Compare = sortg(std::list&lt;int&gt;*, int*)::fnct]'
  prog.cpp:124:63:   required from here
  /usr/include/c++/4.9/bits/stl_algo.h:1968:22: error: no match for       'operator-  
  
  '    (operand types are 'std::_List_iterator&lt;int&gt;' and   
  
  'std::_List_iterator&lt;int&gt;')
   std::__lg(__last - __first)     
  
  *2,/usr/include/c++/4.9/bits/stl_algo.h:1968:22: note:      
  
  'std::_List_iterator&lt;int&gt;' is not derived from 'const    
  
  std::move_iterator&lt;_Iterator&gt;'
   std::__lg(__last - __first) * 2,
  
  
                   "Lines are removed from here"
                    ^
  In file included from /usr/include/c++/4.9/vector:65:0,
               from /usr/include/c++/4.9/bits/random.h:34,
               from /usr/include/c++/4.9/random:49,
               from /usr/include/c++/4.9/bits/stl_algo.h:66,
               from /usr/include/c++/4.9/algorithm:62,
               from prog.cpp:5:
  /usr/include/c++/4.9/bits/stl_bvector.h:208:3: note: std::ptrdiff_t   std::operator-(const std::_Bit_iterator_base&amp;, const std::_Bit_iterator_base&amp;)
  operator-(const _Bit_iterator_base&amp; __x, const _Bit_iterator_base&amp; __y)
  ^
  /usr/include/c++/4.9/bits/stl_bvector.h:208:3: 
  
  note:no known conversion for argument 1 from 'std::_List_iterator&lt;int&gt;' to   
  'const std::_Bit_iterator_base&amp;'
  </code></pre>
  
  <p>Since this error is lengthy i have removed some lines from in between of it</p>