 <p>Because the code you have posted is not the same that the code you are trying to compile.</p> <p>The following line</p> <pre><code>void function1(std::ostream&amp;, const std::string&amp;, double function2(const infocontainer&amp;, const std::string&amp;), const infocontainer, const infocontainer); </code></pre> <p>is missing a <code>const</code> before <code>std::string &amp;</code> in the third parameter in the code you are trying to compile.</p>