title: boost thread with c++ 11lambda
body: <p>How can I use boost thread with C++11 lambda?</p>
  
  <p>The following code doesn't work:</p>
  
  <pre><code>int sum;
  m_workerThread=new boost::thread([]()
          {
                 for(int i=0;i&lt;100;i++)
                 {
                      sum=sum+i;
                  }
          }
          );
  </code></pre>
  
  <p>I am getting compile error.</p>
  
  <pre><code>   Error    4   error C3493: 'sum' cannot be implicitly captured because no default capture mode has been specified 
  </code></pre>
  
  <p>How can I fix this?</p>