title: Use of lambda during member variable initialization within class declaration
body: <p>For readability, I like to initial member variables within class declaration. I am also intrigued by used of lambda during such initialization ( see snippet). My question is what are the advantages or disadvantages of using such lambda functions in the declaration over member functions. </p>
  
  <pre><code>class foo
  {
     private:
        int index_ = 5;
        int value_   = [](int index)
                       {
                           int result = 0;
                           for( int i = 0;i &lt;index; i++)
                              result += i;
                           return result;                             
                       }(index_ );
  
  };
  </code></pre>
  
  <p>Edited:
    As bar::bar(int index) :index_(index) {} is more optimized than bar::bar(int index)  {index_ = index;}, whether the above code performs better or it just the readability.</p>