This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On 09/20/2012 01:55 PM, Marc Glisse wrote:As a matter of fact, in the case of std::max as specified in the Std, thus with a single template parameter used in the three places, I don't see what may go wrong with ?: thus personally I'm back to square one ;) But maybe there is something subtle which I'm still not seeing.Hello,I'm going to tell you something very vague and non technical, but in the past, outside std::max, I had quite often to use the above instead of a conditional operator as a second thought, when (maybe on a less common target) a test "unexpectedly" failed with a conversion error. Does that help you figuring out the technical details of the issue?
I noticed that std::max is implemented as:
//return __a < __b ? __b : __a; if (__a < __b) return __b; return __a;
Notice how it doesn't use the ?: code but the "if" version instead. Looking at the history, this seems to come from SGI. Does someone know why it was done this way?
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |