title: using out of scope variables in C++11 lambda expressions
body: <p>I'm playing with C++11 for fun. I'm wondering why this happens:</p>
  
  <pre><code>//...
  std::vector&lt;P_EndPoint&gt; agents;
  P_CommunicationProtocol requestPacket;
  //...
  bool repeated = std::any_of(agents.begin(), agents.end(),
                      [](P_EndPoint i)-&gt;bool 
                      {return requestPacket.identity().id()==i.id();});
  </code></pre>
  
  <p>Compilation terminates with this error:</p>
  
  <pre><code>error: 'requestPacket' has not been declared
  </code></pre>
  
  <p>Which is declared earlier in code. I tried <code>::requestPacke</code> and it doesn't worked too.</p>
  
  <p>How can I use an external scope variable inside a lambda function? </p>