title: C++ Copy data from float vector to a vector of float pairs
body: <p>I have a destination std vector:</p>
  
  <pre><code> std::vector&lt;std::pair&lt;float,float&gt; &gt; allVertices;
  </code></pre>
  
  <p>Why I want to use pairs,because every 2 floats present locations pair(x,y) .Now,I have a source std:: vector which has all those locations but as float array (called m_vertices).</p>
  
  <p>I need to copy all the data to the end of allVertices from m_vertices and perform transform of the data during the copy.</p>
  
  <p><a href="http://en.cppreference.com/w/cpp/algorithm/transform" rel="nofollow">std::transform</a> came to my mind with <a href="http://en.cppreference.com/w/cpp/language/lambda" rel="nofollow">Lambda</a> but I can't figure out how to do the copy from float vector to the vector of float pairs.</p>
  
  <p>The naive : </p>
  
  <pre><code>    std::transform(m_vertices.begin(),m_vertices.end(),allVertices.end(),
                  [](float x,float y)-&gt;std::pair&lt;float,float&gt;
              {
                  return std::pair&lt;float,float&gt;(x * 100.0f,y * 100.0f)  ;
              }
              );
  </code></pre>
  
  <p>Gives me compile time error :</p>
  
  <blockquote>
    <p>error C2064: term does not evaluate to a function taking 1 arguments</p>
  </blockquote>
  
  <p>And some more ugly stuff.</p>
  
  <p>Btw,if someone could point out how to transform pairs of data without need in std::pair structure it would be even more helpful in my case.</p>
  
  <p>UPDATE:</p>
  
  <p>Due to some answers proposal to use typical iterator,I would like to emphasize that I really would like to see functional solution.If it is possible.</p>