title: vector of future in c++11
body: <p>Hi I have created a vector of future in C++11 using a lambda function.</p>
  
  <pre><code> vector&lt;double&gt; v = { 0, 1.1, 2.2, 3.3, 4.4, 5.5 };
  auto K = [=](double z){
      double y=0; 
  for (const auto x : v)
      y += x*x*z;
  return y;
  };
  vector&lt;future&lt;double&gt;&gt; VF;
  for (double i : {1,2,3,4,5,6,7,8,9})
  VF.push_back(async(K,i));
  </code></pre>
  
  <p>It worked successfully but when I tried to retrieve the values via a for_each call I obtained a compilation error that I do not understand.</p>
  
  <pre><code> for_each(VF.begin(), VF.end(), [](future&lt;double&gt; x){cout &lt;&lt; x.get() &lt;&lt; " "; });
  </code></pre>
  
  <p>The values were successfully obtained by an old style for loop:</p>
  
  <pre><code> for (int i = 0; i &lt; VF.size(); i++)
      cout &lt;&lt; VF[i].get() &lt;&lt; " ";
  </code></pre>
  
  <p>Why I was not able to use the for_each function ? I was using Visual Studio 2013 trying also the INTEL ( V16) compiler.</p>