title: c++ Initialising 2 different iterators in a for loop
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/8644707/can-i-declare-variables-of-different-types-in-the-initialization-of-a-for-loop">Can I declare variables of different types in the initialization of a for loop?</a>  </p>
  </blockquote>
  
  
  
  <p>I'd like to have a for loop in c++ which constructs 2 different kinds of vector iterator in the initialisation.</p>
  
  <p>Here is a rough idea of what I would like:</p>
  
  <pre><code>std::vector&lt;double&gt; dubVec;
  std::vector&lt;int&gt; intVec;
  double result = 0;
  
  dubVec.push_back(3.14);
  intVec.push_back(1);
  
  typedef std::vector&lt;int&gt;::iterator intIter;
  typedef std::vector&lt;double&gt;::iterator dubIter;
  
  for (intIter i = intVec.begin(), dubIter j = dubVec.begin(); i != intVec.end(); ++i, ++j)
  {
    result += (*i) * (*j);
  }
  </code></pre>
  
  <p>Anyone know what is the standard to do in this situation?
  I can't just use a vector of double for the intVec because I'm looking for a general solution.  [i.e. I might have some function f which takes int to double and then calculate f(*i) * (*j)]</p>