title: What is the Reduce for a parallel_reduce in tbb?
body: <p><a href="http://www.threadingbuildingblocks.org/docs/help/reference/algorithms/parallel_reduce_func.htm" rel="nofollow"><code>parallel_reduce</code></a> offers 2 interfaces, the one for the lambdas can be used like showed in the previous link</p>
  
  <pre><code>#include "tbb/parallel_reduce.h"
  #include "tbb/blocked_range.h"
  
  using namespace tbb;
  
  float ParallelSum( float array[], size_t n ) {
      return parallel_reduce( 
          blocked_range&lt;float*&gt;( array, array+n ), 
          0.f, 
          [](const blocked_range&lt;float*&gt;&amp; r, float init)-&gt;float {
              for( float* a=r.begin(); a!=r.end(); ++a ) 
                  init += *a;
              return init;
          },
          []( float x, float y )-&gt;float { // what this lambda does ?
              return x+y;
          }
      );                    
  }
  </code></pre>
  
  <p>the second lambda fits in the <code>const Reduction&amp; reduction</code> signature, I'm studying this lambda trying to change the body or the values, but it does exactly nothing ( even if I put a <code>cout</code> inside, nothing happens ), looks like it's there for no reason at all.</p>
  
  <p>What is the purpose of this <code>Reduction</code> ?
  Has something to do with the <code>0f</code> ? For what I got that <code>0f</code> is a predicate used to detect what are the values that can be skipped, but I still can't figure out what that lambda does ...</p>