Boost C++ Libraries: Ticket #9780: Error in boost_typetraits std::min example? https://svn.boost.org/trac10/ticket/9780 <p> In the documentation for boost_typetraits, an example is given on how to improve std::min. However, at least at first glance it looks like there is a typo. The example reads: </p> <pre class="wiki">template &lt;class T, class U&gt; typename common_type&lt;T, U&gt;::type min(T t, T u) { return t &lt; u ? t : u; } </pre><p> Notice that type <code>T</code> is being used for the argument <code>u</code>. If I understand the example better, the point is that the return type of <code>min</code> will be the correct type. But I would expect the <code>u</code> parameter to still have the type <code>U</code> <strong>not</strong> <code>T</code>. </p> <p> As it is, I believe that this code will cast the second parameter to type <code>T</code> when it is passed to the function. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9780 Trac 1.4.3 Steven Watanabe Sun, 16 Mar 2014 02:44:36 GMT component changed; owner set https://svn.boost.org/trac10/ticket/9780#comment:1 https://svn.boost.org/trac10/ticket/9780#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">John Maddock</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">type_traits</span> </li> </ul> <p> As this stands, you couldn't call min(x, y) because U can't be deduced. </p> Ticket John Maddock Mon, 21 Apr 2014 08:49:04 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/9780#comment:2 https://svn.boost.org/trac10/ticket/9780#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> It's a typo, fixed in develop, thanks! </p> Ticket