title: How to pass a function and its parameters to std::async, inside a member function
body: <p>I'm trying to use <code>std::async</code> inside a member function in the following way:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;string&gt;
  #include &lt;future&gt;
  
  using namespace std;
  
  class splitter
  {
      public:
      splitter() = default;
      virtual ~splitter() = default;
      bool execute(vector&lt;string&gt; &amp;vstr);
      bool split_files(vector&lt;string&gt; &amp;vstr);
  };
  
  bool splitter::split_files(vector&lt;string&gt; &amp;vstr)
  {
      for(auto &amp; file : vstr)
      {
          // do something
          cout &lt;&lt; file &lt;&lt; endl;
      }
      return true;
  }
  
  bool splitter::execute(vector&lt;string&gt; &amp;vstr)
  {
      auto fut = std::async(std::launch::async, split_files, vstr);
      bool good = fut.get();
      return good;
  }
  
  int main()
  {
      vector&lt;string&gt; filenames {
                                  "file1.txt",
                                  "file2.txt",
                                  "file3.txt"
                               };
  
      splitter split;
      split.execute(filenames);
  
      return 0;
  }
  </code></pre>
  
  <p>I would like to use <code>std::async</code> inside a member function to execute another member function in a separate thread, which takes a vector of strings as a parameter.<br/>
  compiling with gcc (9.1) I get the following error:<br/></p>
  
  <pre><code>..\cpp\tests\threads\async1\main.cpp|29|error: no matching function 
  for call to 
  'async(std::launch, &lt;unresolved overloaded function type&gt;, 
  std::vector&lt;std::__cxx11::basic_string&lt;char&gt; &gt;&amp;)'|
  </code></pre>