title: How to use std::for_each on a function pointer list
body: <p>On the following code, how can i rewrite the for loop by using a std::for_each instruction.
  I tried to use <code>boost::lambda::_1</code>, <code>boost::bind</code>, but I could not make it working.</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;iostream&gt;
  #include &lt;cstring&gt;
  #include &lt;cstdlib&gt;
  
  int main() 
  { 
    std::vector&lt;int(*)(const char*)&gt; processors; 
    processors.push_back(std::atoi); 
    processors.push_back(reinterpret_cast&lt;int(*)(const char*)&gt;(std::strlen)); 
  
    const char data[] = "1.23"; 
  
    for(std::vector&lt;int(*)(const char*)&gt;::iterator it = processors.begin();
        it != processors.end(); ++it) 
      std::cout &lt;&lt; (*it)(data) &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>Any hint to help me solve this problem are welcome.</p>
  
  <p>EDIT: Solution</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;iostream&gt;
  #include &lt;cstring&gt;
  #include &lt;cstdlib&gt;
  #include &lt;boost/function.hpp&gt;
  #include &lt;boost/lambda/lambda.hpp&gt;
  #include &lt;boost/lambda/bind.hpp&gt;
  
  int main() 
  { 
    std::vector&lt;boost::function&lt;int(const char*)&gt; &gt; processors; 
    processors.push_back(std::atoi); 
    processors.push_back(std::strlen); 
  
    const char data[] = "1.23"; 
  
    namespace bl = boost::lambda;
    std::for_each(processors.begin(), processors.end(),
        std::cout &lt;&lt; bl::bind(bl::_1, data) &lt;&lt; "\n");
  }
  </code></pre>