Why does std::find_if(first, last, p) not take predicate by reference? : <p>I was looking at the various signatures for <a href="http://en.cppreference.com/w/cpp/algorithm/find" rel="noreferrer"><code>std::find_if</code> on cppreference.com,</a> and I noticed that the flavors that take a predicate function appear to accept it by value:</p>

<pre><code>template&lt; class InputIt, class UnaryPredicate &gt;
InputIt find_if( InputIt first, InputIt last,
             UnaryPredicate p );
</code></pre>

<p>If I understand them correctly, lambdas with captured variables allocate storage for either references or copies of their data, and so presumably a "pass-by-value" would imply that the copies of captured data are copied for the call.</p>

<p>On the other hand, for function pointers and other directly addressable things, the performance should be better if the function pointer is passed directly, rather than by reference-to-pointer (pointer-to-pointer). </p>

<p>First, is this correct? Is the <code>UnaryPredicate</code> above going to be a by-value parameter?</p>

<p>Second, is my understanding of passing lambdas correct?</p>

<p>Third, is there a reason for passing by value instead of by reference in this situation? And more to the point, is there not some sufficiently ambiguous syntax (hello, universal reference) that would let the compiler do whatever it wants to get the most performance out?</p>
