summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/bits/stl_deque.h
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-10 15:18:33 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-10 15:18:33 +0000
commit6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91 (patch)
tree733216f9d05ef2101674b95a354adc2ed369f93c /libstdc++-v3/include/bits/stl_deque.h
parent82b24465847d7b64dc4b01a6e95eb74621546bfb (diff)
downloadppe42-gcc-6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91.tar.gz
ppe42-gcc-6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91.zip
2013-05-10 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/54577 * include/bits/stl_deque.h (erase): Fix signatures in C++11 mode. (_Deque_iterator<>::_M_const_cast): Add. (deque<>::_M_erase): Declare. * include/bits/deque.tcc: ... and define. * include/bits/stl_list.h (erase): Fix signatures in C++11 mode. (_List_const_iterator<>::_M_const_cast): Add. * include/bits/list.tcc (erase (iterator)): Fix. * include/bits/stl_iterator.h (__normal_iterator<>::_M_const_cast): Add; include <ext/cast.h>. * include/bits/stl_vector.h (erase): Fix signatures in C++11 mode. (vector<>::_M_erase): Declare. * include/bits/stl_bvector.h: Likewise. * include/bits/vector.tcc (vector<>::_M_erase): Define. * include/ext/vstring.h (erase): Fix signatures in C++11 mode. * include/debug/deque: Adjust. * include/debug/list: Likewise. * include/debug/vector: Likewise. * include/profile/deque: Likewise. * include/profile/list: Likewise. * include/profile/vector: Likewise. * testsuite/util/exception/safety.h (erase_base<deque>, erase_base<deque>, erase_base<vector>): Remove. (erase_base<__versa_string>): Update. * testsuite/ext/vstring/modifiers/char/54577.cc: New. * testsuite/ext/vstring/modifiers/wchar_t/54577.cc: Likewise. * testsuite/23_containers/deque/modifiers/erase/54577.cc: Likewise. * testsuite/23_containers/list/modifiers/erase/54577.cc: Likewise. * testsuite/23_containers/vector/bool/modifiers/erase/54577.cc: Likewise. * testsuite/23_containers/vector/modifiers/erase/54577.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Adjust dg-error line numbers. * testsuite/23_containers/deque/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198790 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/stl_deque.h')
-rw-r--r--libstdc++-v3/include/bits/stl_deque.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index d07bc4d29f3..4bea82b1807 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -136,6 +136,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
: _M_cur(__x._M_cur), _M_first(__x._M_first),
_M_last(__x._M_last), _M_node(__x._M_node) { }
+ iterator
+ _M_const_cast() const
+ { return iterator(_M_cur, _M_node); }
+
reference
operator*() const
{ return *_M_cur; }
@@ -1562,7 +1566,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* Managing the pointer is the user's responsibility.
*/
iterator
- erase(iterator __position);
+#if __cplusplus >= 201103L
+ erase(const_iterator __position)
+ { return _M_erase(__position._M_const_cast()); }
+#else
+ erase(iterator __position)
+ { return _M_erase(__position); }
+#endif
/**
* @brief Remove a range of elements.
@@ -1581,7 +1591,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* way. Managing the pointer is the user's responsibility.
*/
iterator
- erase(iterator __first, iterator __last);
+#if __cplusplus >= 201103L
+ erase(const_iterator __first, const_iterator __last)
+ { return _M_erase(__first._M_const_cast(), __last._M_const_cast()); }
+#else
+ erase(iterator __first, iterator __last)
+ { return _M_erase(__first, __last); }
+#endif
/**
* @brief Swaps data with another %deque.
@@ -1873,6 +1889,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
this->_M_impl._M_finish = __pos;
}
+ iterator
+ _M_erase(iterator __pos);
+
+ iterator
+ _M_erase(iterator __first, iterator __last);
+
#if __cplusplus >= 201103L
// Called by resize(sz).
void
OpenPOWER on IntegriCloud