std::max: if versus ?:

Marc Glisse marc.glisse@inria.fr
Sun Sep 23 15:09:00 GMT 2012


On Sun, 23 Sep 2012, Paolo Carlini wrote:

> On 09/23/2012 04:37 PM, Marc Glisse wrote:
>> On Sun, 23 Sep 2012, Paolo Carlini wrote:
>> 
>>> .. guys, let me know if you want me to revert the change. IMHO, however, 
>>> somewhere else something is wrong if using a conditional operator instead 
>>> of an 'if' as implementation detail causes troubles with the vector 
>>> extension.
>> 
>> Thanks Paolo. It doesn't cause trouble, it's just that it doesn't help as 
>> much as I hoped.
> Understood. But whatever we do in this area, let's *please* manage to avoid 
> changing std::max to what you just posted...

I guess you wouldn't be happy with an 
enable_if<!__is_vector<_Tp>::value>::type
either (plus overloads of max for vectors)?

Then that may mean no std::max for vectors, at least until someone makes 
the inner type and size of vectors deducible (that would make the vector 
version of max more specialized than the generic one and allow overloads 
without touching the generic function). Which isn't that bad, people are 
big enough to write (x<y)?y:x themselves...

-- 
Marc Glisse



More information about the Libstdc++ mailing list