title: Is there an STL/boost algorithm to check all elements in a container match a value?
body: <p>Is there an STL/boost algorithm that will test if all the elements between two iterators match a given value? Or alternatively that a predicate returns <code>true</code> for all of them?</p>
  
  <p>i.e. something like</p>
  
  <pre><code>template&lt;class InputIterator, class T&gt;
  InputIterator all_match (InputIterator first, InputIterator last, const T&amp; value)
  {
      bool allMatch = true;
      while(allMatch &amp;&amp; first!=last)
          allMatch = (value == *first++);
      return allMatch;
  }
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>template &lt;class InputIterator, class Predicate&gt;
  bool all_true (InputIterator first, InputIterator last, Predicate pred)
  {
      bool allTrue = true;
      while (allTrue &amp;&amp; first != last) 
          allTrue = pred(*first++);
      return allTrue;
  }
  </code></pre>