title: Failed to call class member function in C++ lambda expression
body: <pre><code>//==== 1 ====
  string func1(string x1, string x2){
      return x1 + x2;
  }
  auto lambda1 = [](string x1, string x2){cout &lt;&lt; func1(x1,x2);};
  
  //==== 2 ====
  class Test{
  public:
      string func2(string x1, string x2){
          return x1 + x2;
      }
      void tst(){
          auto lambda2 = [](string x1, string x2){cout &lt;&lt; func2(x1,x2);};
      }
  };
  </code></pre>
  
  <p>lambda1 is right.
  But lambda2 got an error (under g++ 4.8):</p>
  
  <pre><code>error: 'this' was not captured for this lambda function
           auto lambda2 = [](string x1, string x2){cout &lt;&lt; func2(x1,x2);};
  </code></pre>
  
  <p>What's the right way to call a member function in lambda?</p>