diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-18 10:33:36 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-18 10:33:36 +0000 |
commit | 0f15bf2ebe4b001a06ab7869f0c7bcbb74b5469e (patch) | |
tree | 7393ac7f037f04ea997b60a08f0eba639c9798d6 /libstdc++-v3/include/profile | |
parent | 80135bd9bbf06da9d0214ece3c59c301d3af3a2b (diff) | |
download | gcc-0f15bf2ebe4b001a06ab7869f0c7bcbb74b5469e.tar.gz |
2010-11-18 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 166897
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@166899 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/profile')
-rw-r--r-- | libstdc++-v3/include/profile/map.h | 41 | ||||
-rw-r--r-- | libstdc++-v3/include/profile/multimap.h | 19 | ||||
-rw-r--r-- | libstdc++-v3/include/profile/multiset.h | 16 | ||||
-rw-r--r-- | libstdc++-v3/include/profile/set.h | 22 | ||||
-rw-r--r-- | libstdc++-v3/include/profile/unordered_map | 25 |
5 files changed, 102 insertions, 21 deletions
diff --git a/libstdc++-v3/include/profile/map.h b/libstdc++-v3/include/profile/map.h index 5bc9ab9f81b..555f4386349 100644 --- a/libstdc++-v3/include/profile/map.h +++ b/libstdc++-v3/include/profile/map.h @@ -219,6 +219,15 @@ namespace __profile return _Base::operator[](__k); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + mapped_type& + operator[](key_type&& __k) + { + __profcxx_map_to_unordered_map_find(this, size()); + return _Base::operator[](std::move(__k)); + } +#endif + mapped_type& at(const key_type& __k) { @@ -245,6 +254,22 @@ namespace __profile } #ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename _Pair, typename = typename + std::enable_if<std::is_convertible<_Pair, + value_type>::value>::type> + std::pair<iterator, bool> + insert(_Pair&& __x) + { + __profcxx_map_to_unordered_map_insert(this, size(), 1); + typedef typename _Base::iterator _Base_iterator; + std::pair<_Base_iterator, bool> __res + = _Base::insert(std::forward<_Pair>(__x)); + return std::pair<iterator, bool>(iterator(__res.first), + __res.second); + } +#endif + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ void insert(std::initializer_list<value_type> __list) { @@ -269,6 +294,22 @@ namespace __profile return __i; } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename _Pair, typename = typename + std::enable_if<std::is_convertible<_Pair, + value_type>::value>::type> + iterator + insert(const_iterator __position, _Pair&& __x) + { + size_type size_before = size(); + iterator __i + = iterator(_Base::insert(__position, std::forward<_Pair>(__x))); + __profcxx_map_to_unordered_map_insert(this, size_before, + size() - size_before); + return __i; + } +#endif + template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) diff --git a/libstdc++-v3/include/profile/multimap.h b/libstdc++-v3/include/profile/multimap.h index 6fe7f5bc0d9..7f1db940b89 100644 --- a/libstdc++-v3/include/profile/multimap.h +++ b/libstdc++-v3/include/profile/multimap.h @@ -186,6 +186,15 @@ namespace __profile { return iterator(_Base::insert(__x)); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename _Pair, typename = typename + std::enable_if<std::is_convertible<_Pair, + value_type>::value>::type> + iterator + insert(_Pair&& __x) + { return iterator(_Base::insert(std::forward<_Pair>(__x))); } +#endif + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ void insert(std::initializer_list<value_type> __list) { _Base::insert(__list); } @@ -199,6 +208,16 @@ namespace __profile #endif { return iterator(_Base::insert(__position, __x)); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename _Pair, typename = typename + std::enable_if<std::is_convertible<_Pair, + value_type>::value>::type> + iterator + insert(const_iterator __position, _Pair&& __x) + { return iterator(_Base::insert(__position, + std::forward<_Pair>(__x))); } +#endif + template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) diff --git a/libstdc++-v3/include/profile/multiset.h b/libstdc++-v3/include/profile/multiset.h index d66fa0cd97c..ff95f881add 100644 --- a/libstdc++-v3/include/profile/multiset.h +++ b/libstdc++-v3/include/profile/multiset.h @@ -183,14 +183,22 @@ namespace __profile insert(const value_type& __x) { return iterator(_Base::insert(__x)); } - iterator #ifdef __GXX_EXPERIMENTAL_CXX0X__ - insert(const_iterator __position, const value_type& __x) -#else - insert(iterator __position, const value_type& __x) + iterator + insert(value_type&& __x) + { return iterator(_Base::insert(std::move(__x))); } #endif + + iterator + insert(const_iterator __position, const value_type& __x) { return iterator(_Base::insert(__position, __x)); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + iterator + insert(const_iterator __position, value_type&& __x) + { return iterator(_Base::insert(__position, std::move(__x))); } +#endif + template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) diff --git a/libstdc++-v3/include/profile/set.h b/libstdc++-v3/include/profile/set.h index f6941ebbee9..96b7be42ba5 100644 --- a/libstdc++-v3/include/profile/set.h +++ b/libstdc++-v3/include/profile/set.h @@ -188,14 +188,28 @@ namespace __profile __res.second); } - iterator #ifdef __GXX_EXPERIMENTAL_CXX0X__ - insert(const_iterator __position, const value_type& __x) -#else - insert(iterator __position, const value_type& __x) + std::pair<iterator, bool> + insert(value_type&& __x) + { + typedef typename _Base::iterator _Base_iterator; + std::pair<_Base_iterator, bool> __res + = _Base::insert(std::move(__x)); + return std::pair<iterator, bool>(iterator(__res.first), + __res.second); + } #endif + + iterator + insert(const_iterator __position, const value_type& __x) { return iterator(_Base::insert(__position, __x)); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + iterator + insert(const_iterator __position, value_type&& __x) + { return iterator(_Base::insert(__position, std::move(__x))); } +#endif + template <typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) diff --git a/libstdc++-v3/include/profile/unordered_map b/libstdc++-v3/include/profile/unordered_map index 49345cc53ae..6d6a8b7e58e 100644 --- a/libstdc++-v3/include/profile/unordered_map +++ b/libstdc++-v3/include/profile/unordered_map @@ -170,7 +170,7 @@ namespace __profile { size_type __old_size = _Base::bucket_count(); _Base::insert(__l); - _M_profile_resize(__old_size, _Base::bucket_count()); + _M_profile_resize(__old_size); } std::pair<iterator, bool> @@ -178,7 +178,7 @@ namespace __profile { size_type __old_size = _Base::bucket_count(); std::pair<iterator, bool> __res = _Base::insert(__obj); - _M_profile_resize(__old_size, _Base::bucket_count()); + _M_profile_resize(__old_size); return __res; } @@ -187,7 +187,7 @@ namespace __profile { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(__iter, __v); - _M_profile_resize(__old_size, _Base::bucket_count()); + _M_profile_resize(__old_size); return __res; } @@ -200,7 +200,7 @@ namespace __profile size_type __old_size = _Base::bucket_count(); std::pair<iterator, bool> __res = _Base::insert(std::forward<_Pair>(__obj)); - _M_profile_resize(__old_size, _Base::bucket_count()); + _M_profile_resize(__old_size); return __res; } @@ -212,7 +212,7 @@ namespace __profile { size_type __old_size = _Base::bucket_count(); iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v)); - _M_profile_resize(__old_size, _Base::bucket_count()); + _M_profile_resize(__old_size); return __res; } @@ -222,7 +222,7 @@ namespace __profile { size_type __old_size = _Base::bucket_count(); _Base::insert(__first, __last); - _M_profile_resize(__old_size, _Base::bucket_count()); + _M_profile_resize(__old_size); } void @@ -230,7 +230,7 @@ namespace __profile { size_type __old_size = _Base::bucket_count(); _Base::insert(__first, __last); - _M_profile_resize(__old_size, _Base::bucket_count()); + _M_profile_resize(__old_size); } // operator[] @@ -239,8 +239,7 @@ namespace __profile { size_type __old_size = _Base::bucket_count(); mapped_type& __res = _M_base()[__k]; - size_type __new_size = _Base::bucket_count(); - _M_profile_resize(__old_size, _Base::bucket_count()); + _M_profile_resize(__old_size); return __res; } @@ -249,8 +248,7 @@ namespace __profile { size_type __old_size = _Base::bucket_count(); mapped_type& __res = _M_base()[std::move(__k)]; - size_type __new_size = _Base::bucket_count(); - _M_profile_resize(__old_size, _Base::bucket_count()); + _M_profile_resize(__old_size); return __res; } @@ -262,13 +260,14 @@ namespace __profile { size_type __old_size = _Base::bucket_count(); _Base::rehash(__n); - _M_profile_resize(__old_size, _Base::bucket_count()); + _M_profile_resize(__old_size); } private: void - _M_profile_resize(size_type __old_size, size_type __new_size) + _M_profile_resize(size_type __old_size) { + size_type __new_size = _Base::bucket_count(); if (__old_size != __new_size) __profcxx_hashtable_resize(this, __old_size, __new_size); } |