title: std::async and lambda function in C++ gives no associated state
body: <p>I'm trying to obtain a better performance in my program by using async whenever this is convenient. My program compiles, but I get the following error every time I use a function containing async calls:</p>
  
  <pre><code>C++ exception with description "No associated state"
  </code></pre>
  
  <p>The way I am trying to call async with a lambda is e.g. as follows:</p>
  
  <pre><code>auto f = [this](const Cursor&amp; c){ return this-&gt;getAbsIndex(c); };
  auto nodeAbsIndex = std::async(f,node); // node is const Cursor&amp;
  auto otherAbsIndex = std::async(f,other); // other too
  
  size_t from = std::min(nodeAbsIndex.get(), otherAbsIndex.get());
  size_t to = std::max(nodeAbsIndex.get(), otherAbsIndex.get());
  </code></pre>
  
  <p>Signature of the function to call is as follows:</p>
  
  <pre><code>uint64_t getAbsIndex(const Cursor&amp; c) const
  </code></pre>
  
  <p>What am I doing wrong here? Thanks for any hints!
  Diego</p>