title: Class and std::async on class member in C++
body: <p>I'm try to write a class member which calls another class member multiple times in parallel.</p>
  
  <p>I wrote a simple example of the problem and can't even get to compile this. What am I doing wrong with calling std::async? I guess the problem would be with how I'm passing the the function. </p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;future&gt;
  using namespace std;
  class A
  {
      int a,b;
  public: 
      A(int i=1, int j=2){ a=i; b=j;} 
  
      std::pair&lt;int,int&gt; do_rand_stf(int x,int y)
      {
          std::pair&lt;int,int&gt; ret(x+a,y+b);
          return ret;
      }
  
      void run()
      {
          std::vector&lt;std::future&lt;std::pair&lt;int,int&gt;&gt;&gt; ran;
          for(int i=0;i&lt;2;i++)
          {
              for(int j=0;j&lt;2;j++)
              {
                  auto hand=async(launch::async,do_rand_stf,i,j);
                  ran.push_back(hand);    
              }
          }
          for(int i=0;i&lt;ran.size();i++)
          {
              pair&lt;int,int&gt; ttt=ran[i].get();
              cout &lt;&lt; ttt.first &lt;&lt; ttt.second &lt;&lt; endl;
          } 
      }
  };
  
  int main()
  {
      A a;
      a.run();
  }
  </code></pre>
  
  <p>compilation:</p>
  
  <pre><code>g++ -std=c++11 -pthread main.cpp 
  </code></pre>