title: boost zip_iterator and std::sort
body: <p>I have two arrays <code>values</code> and <code>keys</code> both of the same length. 
  I want to sort-by-key the <code>values</code> array using the <code>keys</code> array as keys.
  I have been told the boost's zip iterator is just the right tool for <strong>locking</strong> two arrays together and doing stuff to them at the same time.  </p>
  
  <p>Here is my attempt at using the boost::zip_iterator to solve sorting problem which fails to compile with <code>gcc</code>. Can someone help me fix this code? </p>
  
  <p>The problem lies in the line </p>
  
  <p><code>std::sort ( boost::make_zip_iterator( keys, values  ), boost::make_zip_iterator( keys+N  , values+N ));</code></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  #include &lt;cstdlib&gt;
  #include &lt;ctime&gt;
  #include &lt;vector&gt;
  #include &lt;algorithm&gt;
  #include &lt;boost/iterator/zip_iterator.hpp&gt;
  #include &lt;boost/tuple/tuple.hpp&gt;
  #include &lt;boost/tuple/tuple_comparison.hpp&gt;
  
  
  
  int main(int argc, char *argv[])
  {
    int N=10;
    int    keys[N];
    double values[N];
    int M=100;
  
    //Create the vectors.
    for (int i = 0; i &lt; N; ++i)
     {
       keys[i]   = rand()%M;
       values[i] = 1.0*rand()/RAND_MAX;
     }
  
  
    //Now we use the boost zip iterator to zip the two vectors and sort them "simulatneously"
    //I want to sort-by-key the keys and values arrays
     std::sort ( boost::make_zip_iterator( keys, values  ), 
                 boost::make_zip_iterator( keys+N  , values+N    )
               );
      //The values array and the corresponding keys in ascending order. 
     for (int i = 0; i &lt; N; ++i)
      {
        std::cout &lt;&lt; keys[i]   &lt;&lt;  "\t"  &lt;&lt; values[i]    &lt;&lt; std::endl;  
       }
    return 0;
  }
  </code></pre>
  
  <p>NOTE:Error message on compilation</p>
  
  <pre><code>g++ -g -Wall boost_test.cpp 
  boost_test.cpp: In function ‘int main(int, char**)’:
  boost_test.cpp:37:56: error: no matching function for call to ‘make_zip_iterator(int [(((unsigned int)(((int)N) + -0x00000000000000001)) + 1)], double [(((unsigned int)(((int)N) + -0x00000000000000001)) + 1)])’
  boost_test.cpp:38:64: error: no matching function for call to ‘make_zip_iterator(int*, double*)’
  </code></pre>