title: How many elements are there between two iterators
body: <p>What's the best way to count all elements in an iterator?</p>
  
  <p>I want code equivalent to this</p>
  
  <pre><code>template&lt;typename T,typename S,S val&gt;
  struct ConstantFunctor : unary_function&lt;T,S&gt;
  {S operator()(const T&amp;) const {return val;}};
  template&lt;typename T&gt;
  struct TrueFunctor : ConstantFunctor&lt;T,bool,true&gt;{};
  ...
  count_if(c.begin(),c.end(),TrueFunctor());
  </code></pre>
  
  <p>What's the best way to do that?</p>
  
  <p>I can use <code>boost::lambda::constant(true)</code>, but maybe there's something clearer.</p>