title: How can I call a lambda function from another lambda function
body: <p>Consider the contrived class below with a method A() that contains two lambda functions, a1() and a2(). I'd like to be able to invoke a2 from inside a1. However, when I do so, (the second line inside a1), I get the error</p>
  
  <p><em>Error: variable “cannot be implicitly captured because no default capture mode has been specified”</em></p>
  
  <p>I don't understand this error message. What am I supposed to be capturing here? I understand that using <strong>[this]</strong> in the lambda definition gives me access to methods in class foo but I'm unclear as to how to do what I want.</p>
  
  <p>Thanks in advance for setting me straight on this.</p>
  
  <pre><code>class foo
  {
     void A()
     {
        auto a2 = [this]() -&gt; int
        {
           return 1;
        };
  
        auto  a1 = [this]() -&gt; int
           {
              int result;
              result = a2();
              return result;
           };
  
        int i = a1();
        int j = a2();
     }
  };
  </code></pre>