title: Future with Coroutines co_await
body: <p>Watching a c++ lecture (<a href="https://youtu.be/DLLt4anKXKU?t=1589" rel="nofollow noreferrer">https://youtu.be/DLLt4anKXKU?t=1589</a>), I tried to understand how future work with co_await; example:</p>
  
  <pre><code>auto compute = []() -&gt; std::future&lt;int&gt; {
  int fst = co_await std::async(get_first);
  int snd = co_await std::async(get_second);
  co_return fst + snd;
  };
  auto f = compute();
  /* some heavy task */ 
  f.get();
  </code></pre>
  
  <p>I can't understand how and when <code>co_await std::async(get_first)</code> returns control to <code>compute</code>. i.e how <code>std::future</code> implements an awaitable interface (type).</p>