summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/bits/stl_algo.h
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-17 22:58:38 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-17 22:58:38 +0000
commit7b64e03cdc2be61f271794e45338b3981ff93d29 (patch)
treef8d258492877d9eed5906263f6df625b1d47478a /libstdc++-v3/include/bits/stl_algo.h
parentf6f6f7269dddd0205dd3ea6030ff3057f15159ae (diff)
downloadppe42-gcc-7b64e03cdc2be61f271794e45338b3981ff93d29.tar.gz
ppe42-gcc-7b64e03cdc2be61f271794e45338b3981ff93d29.zip
2008-09-17 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/37547 * include/bits/stl_algo.h (min(initializer_list<>), min(initializer_list<>, Compare), max(initializer_list<>), max(initializer_list<>, Compare), minmax(initializer_list<>), minmax(initializer_list<>, Compare)): Fix return type. * include/bits/algorithmfwd.h: Adjust. * testsuite/25_algorithms/headers/algorithm/synopsis.cc: Likewise. * testsuite/25_algorithms/max/requirements/explicit_instantiation/3.cc: Likewise. * testsuite/25_algorithms/max/requirements/explicit_instantiation/ pod2.cc: Likewise. * testsuite/25_algorithms/min/requirements/explicit_instantiation/3.cc: Likewise. * testsuite/25_algorithms/min/requirements/explicit_instantiation/ pod2.cc: Likewise. * testsuite/25_algorithms/minmax/requirements/explicit_instantiation/ 3.cc: Likewise. * testsuite/25_algorithms/minmax/requirements/explicit_instantiation/ pod2.cc: Likewise. * testsuite/25_algorithms/max/37547.cc: New. * testsuite/25_algorithms/min/37547.cc: Likewise. * testsuite/25_algorithms/minmax/37547.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140435 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/stl_algo.h')
-rw-r--r--libstdc++-v3/include/bits/stl_algo.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index 42ada9986f3..373881c7f1b 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -4094,38 +4094,38 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return std::make_pair(__min, __max);
}
- // N2722.
+ // N2722 + fixes.
template<typename _Tp>
- inline const _Tp&
+ inline _Tp
min(initializer_list<_Tp> __l)
{ return *std::min_element(__l.begin(), __l.end()); }
template<typename _Tp, typename _Compare>
- inline const _Tp&
+ inline _Tp
min(initializer_list<_Tp> __l, _Compare __comp)
{ return *std::min_element(__l.begin(), __l.end(), __comp); }
template<typename _Tp>
- inline const _Tp&
+ inline _Tp
max(initializer_list<_Tp> __l)
{ return *std::max_element(__l.begin(), __l.end()); }
template<typename _Tp, typename _Compare>
- inline const _Tp&
+ inline _Tp
max(initializer_list<_Tp> __l, _Compare __comp)
{ return *std::max_element(__l.begin(), __l.end(), __comp); }
template<typename _Tp>
- inline pair<const _Tp&, const _Tp&>
+ inline pair<_Tp, _Tp>
minmax(initializer_list<_Tp> __l)
{
pair<const _Tp*, const _Tp*> __p =
std::minmax_element(__l.begin(), __l.end());
- return std::make_pair(*__p.first, *__p.second);
+ return std::pair<_Tp, _Tp>(*__p.first, *__p.second);
}
template<typename _Tp, typename _Compare>
- inline pair<const _Tp&, const _Tp&>
+ inline pair<_Tp, _Tp>
minmax(initializer_list<_Tp> __l, _Compare __comp)
{
pair<const _Tp*, const _Tp*> __p =
OpenPOWER on IntegriCloud