title: Would std::count_if be faster without an if?
body: <p>Here's the gcc <code>std::count_if</code> code</p>
  
  <pre><code>template&lt;typename _InputIterator, typename _Predicate&gt;
    typename iterator_traits&lt;_InputIterator&gt;::difference_type
    count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
   {
    [snip]
    typename iterator_traits&lt;_InputIterator&gt;::difference_type __n = 0;
    for (; __first != __last; ++__first)
      if (__pred(*__first))
        ++__n;
    return __n;
  }
  </code></pre>
  
  <p>My question: would it work better (i.e., faster) to use</p>
  
  <pre><code>__n += __pred(*__first); // instead of the if statement
  </code></pre>
  
  <p>This version always does an add, but doesn't do a branch.</p>