diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-14 18:41:01 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-14 18:41:01 +0000 |
commit | b3bea0f2c5c7bf1eb40ef0861e58ad4827a0ae3f (patch) | |
tree | fcb23e8bb645ab48cfb497aef32b65dbdf8d822d /libstdc++-v3 | |
parent | 55a2a0a387078fca46ea83533606c99121e5156b (diff) | |
download | gcc-b3bea0f2c5c7bf1eb40ef0861e58ad4827a0ae3f.tar.gz |
2010-11-14 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_tree.h (_Rb_tree<>::_M_const_cast_iter): Remove.
(_Rb_tree_const_iterator<>::_M_const_cast): Add.
(_Rb_tree<>::erase, _M_insert_unique_): Adjust.
* include/debug/map.h (map<>::erase, insert): Fix C++0x signatures.
* include/debug/multimap.h (multimap<>::erase, insert): Likewise.
* include/debug/set.h (set<>::erase, insert): Fix, only cosmetic
changes in this case.
* include/debug/multiset.h (multiset<>::erase, insert): Likewise.
* include/profile/set.h (set<>::insert): Remove redundant macro.
* include/profile/multiset.h (multiset<>::insert): Likewise.
* include/bits/stl_set.h (set<>::insert): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166734 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 15 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_multiset.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_set.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_tree.h | 16 | ||||
-rw-r--r-- | libstdc++-v3/include/debug/map.h | 10 | ||||
-rw-r--r-- | libstdc++-v3/include/debug/multimap.h | 12 | ||||
-rw-r--r-- | libstdc++-v3/include/debug/multiset.h | 8 | ||||
-rw-r--r-- | libstdc++-v3/include/debug/set.h | 8 | ||||
-rw-r--r-- | libstdc++-v3/include/profile/multiset.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/profile/set.h | 4 |
10 files changed, 46 insertions, 39 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f5a97b3be7e..0e0418b87a9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,18 @@ +2010-11-14 Paolo Carlini <paolo.carlini@oracle.com> + + * include/bits/stl_tree.h (_Rb_tree<>::_M_const_cast_iter): Remove. + (_Rb_tree_const_iterator<>::_M_const_cast): Add. + (_Rb_tree<>::erase, _M_insert_unique_): Adjust. + * include/debug/map.h (map<>::erase, insert): Fix C++0x signatures. + * include/debug/multimap.h (multimap<>::erase, insert): Likewise. + * include/debug/set.h (set<>::erase, insert): Fix, only cosmetic + changes in this case. + * include/debug/multiset.h (multiset<>::erase, insert): Likewise. + * include/profile/set.h (set<>::insert): Remove redundant macro. + * include/profile/multiset.h (multiset<>::insert): Likewise. + * include/bits/stl_set.h (set<>::insert): Likewise. + * include/bits/stl_multiset.h (multiset<>::insert): Likewise. + 2010-11-12 Ian Lance Taylor <iant@google.com> PR other/46332 diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index 629da6b1ec6..58f902c53f0 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -423,11 +423,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) * Insertion requires logarithmic time (if the hint is not taken). */ iterator -#ifdef __GXX_EXPERIMENTAL_CXX0X__ insert(const_iterator __position, const value_type& __x) -#else - insert(iterator __position, const value_type& __x) -#endif { return _M_t._M_insert_equal_(__position, __x); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index c44b303fa99..8d82716d3cb 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -439,11 +439,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) * Insertion requires logarithmic time (if the hint is not taken). */ iterator -#ifdef __GXX_EXPERIMENTAL_CXX0X__ insert(const_iterator __position, const value_type& __x) -#else - insert(iterator __position, const value_type& __x) -#endif { return _M_t._M_insert_unique_(__position, __x); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index 0974f9173d3..89190306315 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -247,6 +247,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _Rb_tree_const_iterator(const iterator& __it) : _M_node(__it._M_node) { } + iterator + _M_const_cast() const + { return iterator(static_cast<typename iterator::_Link_type> + (const_cast<typename iterator::_Base_ptr>(_M_node))); } + reference operator*() const { return static_cast<_Link_type>(_M_node)->_M_value_field; } @@ -556,11 +561,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typedef std::reverse_iterator<const_iterator> const_reverse_iterator; private: - iterator - _M_const_cast_iter(const_iterator __cit) - { return iterator(static_cast<_Link_type> - (const_cast<_Base_ptr>(__cit._M_node))); } - #ifdef __GXX_EXPERIMENTAL_CXX0X__ template<typename _Arg> iterator @@ -756,7 +756,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) const_iterator __result = __position; ++__result; _M_erase_aux(__position); - return _M_const_cast_iter(__result); + return __result._M_const_cast(); } #else void @@ -773,7 +773,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) erase(const_iterator __first, const_iterator __last) { _M_erase_aux(__first, __last); - return _M_const_cast_iter(__last); + return __last._M_const_cast(); } #else void @@ -1364,7 +1364,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } else // Equivalent keys. - return _M_const_cast_iter(__position); + return __position._M_const_cast(); } template<typename _Key, typename _Val, typename _KeyOfValue, diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h index aa5f6121468..6e8858c6706 100644 --- a/libstdc++-v3/include/debug/map.h +++ b/libstdc++-v3/include/debug/map.h @@ -232,7 +232,11 @@ namespace __debug #endif iterator +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + insert(const_iterator __position, const value_type& __x) +#else insert(iterator __position, const value_type& __x) +#endif { __glibcxx_check_insert(__position); return iterator(_Base::insert(__position.base(), __x), this); @@ -262,7 +266,7 @@ namespace __debug #ifdef __GXX_EXPERIMENTAL_CXX0X__ iterator - erase(iterator __position) + erase(const_iterator __position) { __glibcxx_check_erase(__position); __position._M_invalidate(); @@ -294,14 +298,14 @@ namespace __debug #ifdef __GXX_EXPERIMENTAL_CXX0X__ iterator - erase(iterator __first, iterator __last) + erase(const_iterator __first, const_iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); while (__first != __last) this->erase(__first++); - return __last; + return iterator(__last.base()._M_const_cast(), this); } #else void diff --git a/libstdc++-v3/include/debug/multimap.h b/libstdc++-v3/include/debug/multimap.h index c3363b89f47..56f58ffce3b 100644 --- a/libstdc++-v3/include/debug/multimap.h +++ b/libstdc++-v3/include/debug/multimap.h @@ -213,7 +213,11 @@ namespace __debug #endif iterator - insert(iterator __position, const value_type& __x) +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + insert(const_iterator __position, const value_type& __x) +#else + insert(iterator __position, const value_type& __x) +#endif { __glibcxx_check_insert(__position); return iterator(_Base::insert(__position.base(), __x), this); @@ -243,7 +247,7 @@ namespace __debug #ifdef __GXX_EXPERIMENTAL_CXX0X__ iterator - erase(iterator __position) + erase(const_iterator __position) { __glibcxx_check_erase(__position); __position._M_invalidate(); @@ -276,14 +280,14 @@ namespace __debug #ifdef __GXX_EXPERIMENTAL_CXX0X__ iterator - erase(iterator __first, iterator __last) + erase(const_iterator __first, const_iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); while (__first != __last) this->erase(__first++); - return __last; + return iterator(__last.base()._M_const_cast(), this); } #else void diff --git a/libstdc++-v3/include/debug/multiset.h b/libstdc++-v3/include/debug/multiset.h index 76300cd8829..9c950a1d0c2 100644 --- a/libstdc++-v3/include/debug/multiset.h +++ b/libstdc++-v3/include/debug/multiset.h @@ -201,7 +201,7 @@ namespace __debug #endif iterator - insert(iterator __position, const value_type& __x) + insert(const_iterator __position, const value_type& __x) { __glibcxx_check_insert(__position); return iterator(_Base::insert(__position.base(), __x), this); @@ -234,7 +234,7 @@ namespace __debug #ifdef __GXX_EXPERIMENTAL_CXX0X__ iterator - erase(iterator __position) + erase(const_iterator __position) { __glibcxx_check_erase(__position); __position._M_invalidate(); @@ -267,14 +267,14 @@ namespace __debug #ifdef __GXX_EXPERIMENTAL_CXX0X__ iterator - erase(iterator __first, iterator __last) + erase(const_iterator __first, const_iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); while (__first != __last) this->erase(__first++); - return __last; + return __last; // iterator == const_iterator } #else void diff --git a/libstdc++-v3/include/debug/set.h b/libstdc++-v3/include/debug/set.h index 6b4dd6ce0eb..b8ff463b2cf 100644 --- a/libstdc++-v3/include/debug/set.h +++ b/libstdc++-v3/include/debug/set.h @@ -212,7 +212,7 @@ namespace __debug #endif iterator - insert(iterator __position, const value_type& __x) + insert(const_iterator __position, const value_type& __x) { __glibcxx_check_insert(__position); return iterator(_Base::insert(__position.base(), __x), this); @@ -245,7 +245,7 @@ namespace __debug #ifdef __GXX_EXPERIMENTAL_CXX0X__ iterator - erase(iterator __position) + erase(const_iterator __position) { __glibcxx_check_erase(__position); __position._M_invalidate(); @@ -277,14 +277,14 @@ namespace __debug #ifdef __GXX_EXPERIMENTAL_CXX0X__ iterator - erase(iterator __first, iterator __last) + erase(const_iterator __first, const_iterator __last) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container __glibcxx_check_erase_range(__first, __last); while (__first != __last) this->erase(__first++); - return __last; + return __last; // iterator == const_iterator } #else void diff --git a/libstdc++-v3/include/profile/multiset.h b/libstdc++-v3/include/profile/multiset.h index d42a7553033..ff95f881add 100644 --- a/libstdc++-v3/include/profile/multiset.h +++ b/libstdc++-v3/include/profile/multiset.h @@ -190,11 +190,7 @@ namespace __profile #endif iterator -#ifdef __GXX_EXPERIMENTAL_CXX0X__ insert(const_iterator __position, const value_type& __x) -#else - insert(iterator __position, const value_type& __x) -#endif { return iterator(_Base::insert(__position, __x)); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ diff --git a/libstdc++-v3/include/profile/set.h b/libstdc++-v3/include/profile/set.h index 8fb48961974..96b7be42ba5 100644 --- a/libstdc++-v3/include/profile/set.h +++ b/libstdc++-v3/include/profile/set.h @@ -201,11 +201,7 @@ namespace __profile #endif iterator -#ifdef __GXX_EXPERIMENTAL_CXX0X__ insert(const_iterator __position, const value_type& __x) -#else - insert(iterator __position, const value_type& __x) -#endif { return iterator(_Base::insert(__position, __x)); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ |