title: Count elements using std::accumulate algorithm and lambda expressions
body: <p>Here's is my problem: </p>
  
  <p>I need to count the total number of elements of several std::vector contained into a std::map of type std::map>;</p>
  
  <p>To count the total number of elements I use the following code:</p>
  
  <pre><code>std::map&lt;int, std::vector&lt;float&gt;&gt;::iterator vertex_It = myMap.begin();
  uint32_t total_byte_size = 0;
  
  for (; vertex_It != myMap.end(); ++vertex_It)
      total_byte_size += vertex_It-&gt;second.size() * sizeof(float);
  </code></pre>
  
  <p>I tried to use std::accumulate algorithm and lambda expressions like below:</p>
  
  <pre><code>uint32_t total_byte_size = 0;
  
  std::accumulate(myMap.begin(), myMap.end(),
      [&amp;total_byte_size](const uint32_t &amp;vertex_type, const std::vector&lt;float&gt; &amp;vertex_attribute) -&gt; bool{
          total_byte_size += vertex_attribute.size();
          return (true);
  });
  </code></pre>
  
  <p>But this code does not compile. I tried different combinations of code without success.</p>
  
  <p>Does it exist a way to use std::accumulate and lambda expressions for this simple problem ?</p>
  
  <p>Thanks a lot in advance for your help!</p>