title: Converting a lambda expression with variable capture to a function pointer
body: <p>I'm trying to use lambda functions to quickly test things out, and I'm running up against a wall with it. I have no idea why things aren't working as (I feel) they should be.</p>
  
  <p>This works as I would expect:</p>
  
  <pre><code>double(*example)(double) = [](double S)-&gt;double {return std::max(1-100/S, 0.0) * LogNormal(S, 100, 0.25); };
  NewtonCotes(lowerBound, upperBound, example, intervals, order)
  </code></pre>
  
  <p>However this does not:</p>
  
  <pre><code>double(*example)(double) = [K](double S)-&gt;double {return std::max(1 - K / S, 0.0) * LogNormal(S, 100, 0.25); };
  </code></pre>
  
  <p>Giving the error:</p>
  
  <blockquote>
    <p>Error: no suitable conversion function from "lambda []double(double S)->double" to "double(*)(double)" exists.</p>
  </blockquote>
  
  <p>I do not understand why adding something to the capture list should change what's going on here. I'm fairly new to lambdas in C++ though, so could be making a silly mistake somewhere...</p>
  
  <p>What do I need to do to get this to work? I've seen a few people noting that there was a bug in intellisense, and that something like this should work, though it was a slightly different issue (at least i didn't think they matched exactly). I'm also using VS2013, rather than 2011 where that bug was mentioned.</p>