title: How to return std::tuple from a std::async task
body: <p>How can I launch a member function as a std::async task, which returns a std::tuple.</p>
  
  <p>Sample code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;future&gt;
  #include &lt;tuple&gt;
  #include &lt;numeric&gt;
  
  
  class Foo {
      bool calc;
  public:
      Foo(bool b) : calc(b) 
      {}
  
      std::tuple&lt;long, double&gt; calc(std::vector&lt;int&gt; a) {
          long sum = 0;
          double avg = 0.0;
  
          if ((*this).calc) {
              long sum = std::accumulate(a.begin(), a.end(), 0);
              double avg = sum / a.size();
          }
          return std::make_tuple(sum, avg);
      }
  
      void call_calc(std::vector&lt;int&gt; i) {
  
          auto handle = std::async(&amp;Foo::calc, this, i);
          auto resultTuple = handle.get();
  
          std::cout &lt;&lt; "Sum = " &lt;&lt; std::get&lt;0&gt;(resultTuple) &lt;&lt; "  Average = " &lt;&lt; std::get&lt;1&gt;(resultTuple) &lt;&lt; std::endl;
      }
  };
  
  int main() {
      std::vector&lt;int&gt; a{ 2, 5, 6, 7, 3 };
      Foo foo(true);
      foo.call_calc(a);
  }
  </code></pre>
  
  <p>In this example, without the member variable, code works fine. 
  The above code is throwing compilation error for following lines:</p>
  
  <pre><code>auto handle = std::async(&amp;Foo::calc, this, i);
  </code></pre>
  
  <p>Error: No instance of overloaded function 'std::async' matches the argument list.</p>
  
  <pre><code>std::cout &lt;&lt; "Sum = " &lt;&lt; std::get&lt;0&gt;(resultTuple) &lt;&lt; "  Average = " &lt;&lt; std::get&lt;1&gt;(resultTuple) &lt;&lt; std::endl;
  </code></pre>
  
  <p>Error: No instance of overloaded function 'std::get' matches the argument list.</p>