title: Binding a templated standard library function
body: <p>How do you do this? The alternative requires wrapping <code>std::generate</code> in a lambda or <code>std::function</code> and that's undesirable.</p>
  
  <pre><code>int main()
  {
      using array_int = std::array&lt;int, 10&gt;;
      std::vector&lt;array_int&gt; vec(10);
      std::for_each(vec.begin(), vec.end(),
          std::bind(std::generate, std::placeholders::_1, []() { return 0; }));
  
      return 0;
  }
  </code></pre>
  
  <p>As noted the problem is <code>std::generate</code> takes an iterator pair. Let's pretend they're boost ranges instead:</p>
  
  <pre><code>boost::for_each(vec,
      boost::bind(boost::generate, _1, []() { return 0; }));
  </code></pre>