diff options
author | Chris Jefferson <chris@bubblescope.net> | 2005-03-21 22:16:15 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2005-03-21 22:16:15 +0000 |
commit | aed63147cb5c4099a4fc3586784be919a84cda04 (patch) | |
tree | 5ccf5ba9c344ca2ba59ec85d7679af5a093cea8b /libstdc++-v3/include/bits | |
parent | ffaf4d3b138deea3fd676c5c9f7d124be4b12bfb (diff) | |
download | gcc-aed63147cb5c4099a4fc3586784be919a84cda04.zip gcc-aed63147cb5c4099a4fc3586784be919a84cda04.tar.gz gcc-aed63147cb5c4099a4fc3586784be919a84cda04.tar.bz2 |
re PR libstdc++/20577 (iter_swap doesn't work anymore with vector<bool>)
2005-03-21 Chris Jefferson <chris@bubblescope.net>
PR libstdc++/20577
* include/bits/stl_algobase.h (iter_swap): Only delegate iter_swap
to swap when the iterator's reference_type is a reference to its
value_type.
* testsuite/25_algorithms/iter_swap/20577.cc: New.
From-SVN: r96837
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r-- | libstdc++-v3/include/bits/stl_algobase.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index a67d2a9..426fcba 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -155,7 +155,14 @@ namespace std _ValueType2>) __glibcxx_function_requires(_ConvertibleConcept<_ValueType2, _ValueType1>) - std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value>:: + + typedef typename iterator_traits<_ForwardIterator1>::reference + _ReferenceType1; + typedef typename iterator_traits<_ForwardIterator2>::reference + _ReferenceType2; + std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value && + __are_same<_ValueType1 &, _ReferenceType1>::__value && + __are_same<_ValueType2 &, _ReferenceType2>::__value>:: iter_swap(__a, __b); } |