title: How to compute distance between std::vector<int>::iterator and std::vector<int>::reverse_iterator?
body: <p>I tried using std::distance like this : </p>
  
  <pre><code>vi::iterator frontIter = resVec.begin();
  vi::reverse_iterator backIter = resVec.rbegin();    
  
  if(std::distance(frontIter , backIter))
  {
      std::cout &lt;&lt; " ! " &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>But the compiler gives me this error.</p>
  
  <pre><code>partion.cpp:46:39: note: candidate is:
  In file included from /usr/include/c++/4.9/bits/stl_algobase.h:66:0,
                   from /usr/include/c++/4.9/vector:60,
                   from test.h:1,
                   from partion.cpp:1:
  /usr/include/c++/4.9/bits/stl_iterator_base_funcs.h:114:5: note: template&lt;class _InputIterator&gt; typename std::iterator_traits&lt;_Iterator&gt;::difference_type std::distance(_InputIterator, _InputIterator)
       distance(_InputIterator __first, _InputIterator __last)
       ^
  /usr/include/c++/4.9/bits/stl_iterator_base_funcs.h:114:5: note:   template argument deduction/substitution failed:
  partion.cpp:46:39: note:   deduced conflicting types for parameter ‘_InputIterator’ (‘__gnu_cxx::__normal_iterator&lt;int*, std::vector&lt;int&gt; &gt;’ and ‘std::reverse_iterator&lt;__gnu_cxx::__normal_iterator&lt;int*, std::vector&lt;int&gt; &gt; &gt;’)
    if(std::distance(frontIter , backIter))
  </code></pre>
  
  <p>So how I find the distance between these two iterators. Better yet, is there a way to solve this problem without using the back_iterator, but two standard iterators ? </p>
  
  <pre><code>for(size idx = 0 ; idx &lt; vec.size() ; ++idx)
  {
      if(idx == n) 
      {
          continue;
      }   
  
      if(vec[idx] &lt; partVal) // insert in front of  partVal
      {
  
          *frontIter = vec[idx];
          ++frontIter;    
      }
      else // insert at back of n
      {
          *backIter = vec[idx];   
          ++backIter;
      }
  
  }
  </code></pre>
  
  <p>Note : </p>
  
  <pre><code>using vi = std::vector&lt;int&gt;;
  using size = std::size_t;
  </code></pre>