title: How pass std::endl to a function and use it?
body: <p>I want to figure out how to pass a manipulator like <code>std::endl</code> to a function and then use the passed-in manipulator in the function. I can declare the function like this:</p>
  
  <pre><code>void f(std::ostream&amp;(*pManip)(std::ostream&amp;));
  </code></pre>
  
  <p>and I can call it like this:</p>
  
  <pre><code>f(std::endl);
  </code></pre>
  
  <p>That's all fine. My problem is figuring out how to use the manipulator inside <code>f</code>. This doesn't work:</p>
  
  <pre><code>void f(std::ostream&amp;(*pManip)(std::ostream&amp;))
  {
    std::cout &lt;&lt; (*pManip)(std::cout);            // error
  }
  </code></pre>
  
  <p>Regardless of compiler, the error message boils down to the compiler not being able to figure out which <code>operator&lt;&lt;</code> to call. What do I need to fix inside <code>f</code> to get my code to compile? </p>