title: an enclosing-function local variable cannot be referenced in a lambda body unless if it is in capture list
body: <p>I have json::value object and I try to get values in a struct but i get this error about capture list. I understand that in then phrase this bracet [] holds capture list but i cant figure out how. How can i return a value in lambda function?</p>
  
  <pre><code>   void JsonDeneme::setValues(json::value obj)
  {
      weather.coord.lon = obj.at(L"coord").at(L"lon").as_double();
      weather.coord.lat= obj.at(L"coord").at(L"lat").as_double();
  
  }
  
  void JsonDeneme::getHttp()
  {
      //json::value val;
      http_client client(U("http://api.openweathermap.org/data/2.5/weather?q=Ankara,TR"));
  
      client.request(methods::GET)
  
      .then([](http_response response) -&gt; pplx::task&lt;json::value&gt;
      {
  
          if (response.status_code() == status_codes::OK)
          {
              printf("Received response status code:%u\n", response.status_code());
              return response.extract_json();
          }
          return pplx::task_from_result(json::value());
      })
  
      .then([ ](pplx::task&lt;json::value&gt; previousTask)
      {
          try
          {
              json::value   v = previousTask.get();
              setValues(v);//-----------------------------------------
          }
          catch (http_exception const &amp; e)
          {
              wcout &lt;&lt; e.what() &lt;&lt; endl;
          }
      })
      .wait();
  
  }
  </code></pre>