Boost C++ Libraries: Ticket #10081: Boost.Algorithm: clamp: discrepancy in parameter & return types between code and online documentation https://svn.boost.org/trac10/ticket/10081 <p> The online documentation of the clamp algorithm of Boost.Algorithm reads <a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a>: </p> <div class="wiki-code"><div class="code"><pre><span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">V</span><span class="o">&gt;</span> <span class="n">V</span> <span class="n">clamp</span> <span class="p">(</span> <span class="n">V</span> <span class="n">val</span><span class="p">,</span> <span class="n">V</span> <span class="n">lo</span><span class="p">,</span> <span class="n">V</span> <span class="n">hi</span> <span class="p">);</span> <span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">V</span><span class="p">,</span> <span class="k">typename</span> <span class="n">Pred</span><span class="o">&gt;</span> <span class="n">V</span> <span class="n">clamp</span> <span class="p">(</span> <span class="n">V</span> <span class="n">val</span><span class="p">,</span> <span class="n">V</span> <span class="n">lo</span><span class="p">,</span> <span class="n">V</span> <span class="n">hi</span><span class="p">,</span> <span class="n">Pred</span> <span class="n">p</span> <span class="p">);</span> </pre></div></div><p> whereas the code <a class="changeset" href="https://svn.boost.org/trac10/changeset/2" title="Add Boost Disclaimer">[2]</a> passes parameters and return value by const reference. Similarly for the sequence variant. </p> <p> I'm wondering if this is on purpose or that it is a mistake in the documentation? </p> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a> Marshall Clow. <a href="http://www.boost.org/doc/libs/1_55_0/libs/algorithm/doc/html/algorithm/Misc.html#the_boost_algorithm_library.Misc.clamp">clamp in the Boost Algorithm Library</a>. </p> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/2" title="Add Boost Disclaimer">[2]</a> <a href="http://www.boost.org/doc/libs/1_55_0/boost/algorithm/clamp.hpp">boost/algorithm/clamp.hpp</a> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10081 Trac 1.4.3 Marshall Clow Tue, 03 Jun 2014 15:23:40 GMT owner, status, component changed https://svn.boost.org/trac10/ticket/10081#comment:1 https://svn.boost.org/trac10/ticket/10081#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Matias Capeletto</span> to <span class="trac-author">Marshall Clow</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>component</strong> <span class="trac-field-old">Documentation</span> → <span class="trac-field-new">algorithm</span> </li> </ul> <p> It's a mistake in the documentation. </p> Ticket Marshall Clow Fri, 10 Apr 2015 15:11:16 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10081#comment:2 https://svn.boost.org/trac10/ticket/10081#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> fixed in [develop 7f7ebc3]. </p> Ticket