stl_algobase.h (max, min): Use conditional operator.
2012-09-21 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/stl_algobase.h (max, min): Use conditional operator. From-SVN: r191608
This commit is contained in:
parent
a3e531ec34
commit
88a4c78be1
@ -1,3 +1,7 @@
|
|||||||
|
2012-09-21 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
|
* include/bits/stl_algobase.h (max, min): Use conditional operator.
|
||||||
|
|
||||||
2012-09-18 Benjamin Kosnik <bkoz@redhat.com>
|
2012-09-18 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
PR libstdc++/28811
|
PR libstdc++/28811
|
||||||
|
@ -195,10 +195,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
{
|
{
|
||||||
// concept requirements
|
// concept requirements
|
||||||
__glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
|
__glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
|
||||||
//return __b < __a ? __b : __a;
|
|
||||||
if (__b < __a)
|
return __b < __a ? __b : __a;
|
||||||
return __b;
|
|
||||||
return __a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -218,10 +216,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
{
|
{
|
||||||
// concept requirements
|
// concept requirements
|
||||||
__glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
|
__glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
|
||||||
//return __a < __b ? __b : __a;
|
|
||||||
if (__a < __b)
|
return __a < __b ? __b : __a;
|
||||||
return __b;
|
|
||||||
return __a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -238,12 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
template<typename _Tp, typename _Compare>
|
template<typename _Tp, typename _Compare>
|
||||||
inline const _Tp&
|
inline const _Tp&
|
||||||
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
|
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
|
||||||
{
|
{ return __comp(__b, __a) ? __b : __a; }
|
||||||
//return __comp(__b, __a) ? __b : __a;
|
|
||||||
if (__comp(__b, __a))
|
|
||||||
return __b;
|
|
||||||
return __a;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This does what you think it does.
|
* @brief This does what you think it does.
|
||||||
@ -259,12 +250,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
template<typename _Tp, typename _Compare>
|
template<typename _Tp, typename _Compare>
|
||||||
inline const _Tp&
|
inline const _Tp&
|
||||||
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
|
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
|
||||||
{
|
{ return __comp(__a, __b) ? __b : __a; }
|
||||||
//return __comp(__a, __b) ? __b : __a;
|
|
||||||
if (__comp(__a, __b))
|
|
||||||
return __b;
|
|
||||||
return __a;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If _Iterator is a __normal_iterator return its base (a plain pointer,
|
// If _Iterator is a __normal_iterator return its base (a plain pointer,
|
||||||
// normally) otherwise return it untouched. See copy, fill, ...
|
// normally) otherwise return it untouched. See copy, fill, ...
|
||||||
|
Loading…
Reference in New Issue
Block a user