From 88a4c78be1f44b8918517382b628f2062c30c834 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 21 Sep 2012 10:48:30 +0000 Subject: [PATCH] stl_algobase.h (max, min): Use conditional operator. 2012-09-21 Paolo Carlini * include/bits/stl_algobase.h (max, min): Use conditional operator. From-SVN: r191608 --- libstdc++-v3/ChangeLog | 4 ++++ libstdc++-v3/include/bits/stl_algobase.h | 26 ++++++------------------ 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3efec87374bb..82ac417aca3c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,7 @@ +2012-09-21 Paolo Carlini + + * include/bits/stl_algobase.h (max, min): Use conditional operator. + 2012-09-18 Benjamin Kosnik PR libstdc++/28811 diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index fe30f6ce9f5e..3099d0d10f6c 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -195,10 +195,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { // concept requirements __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) - //return __b < __a ? __b : __a; - if (__b < __a) - return __b; - return __a; + + return __b < __a ? __b : __a; } /** @@ -218,10 +216,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { // concept requirements __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) - //return __a < __b ? __b : __a; - if (__a < __b) - return __b; - return __a; + + return __a < __b ? __b : __a; } /** @@ -238,12 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template inline const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) - { - //return __comp(__b, __a) ? __b : __a; - if (__comp(__b, __a)) - return __b; - return __a; - } + { return __comp(__b, __a) ? __b : __a; } /** * @brief This does what you think it does. @@ -259,12 +250,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template inline const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) - { - //return __comp(__a, __b) ? __b : __a; - if (__comp(__a, __b)) - return __b; - return __a; - } + { return __comp(__a, __b) ? __b : __a; } // If _Iterator is a __normal_iterator return its base (a plain pointer, // normally) otherwise return it untouched. See copy, fill, ... -- 2.47.2