std::max: if versus ?:
Paolo Carlini
paolo.carlini@oracle.com
Thu Sep 20 12:29:00 GMT 2012
On 09/20/2012 02:24 PM, Marc Glisse wrote:
> When a and b have possibly different types, using "if" makes a lot of
> sense (I even advocated replacing ?: with "if" somewhere in the gcc
> codebase in PR50177). Inside std::max, a and b both have exactly the
> same type const _Tp&, so it shouldn't matter.
>
> Note that libcxx uses ?: for its implementation of std::max.
>
> I assume there are historical reasons, some compilers had bugs in
> their ?: support or produced slightly faster code with "if"...
>
Good, good, consider a patch pre-approved ;)
Paolo.
More information about the Libstdc++
mailing list