diff options
author | fdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-24 19:53:36 +0000 |
---|---|---|
committer | fdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-24 19:53:36 +0000 |
commit | 6b9314a80cb4d41e7072d7620ac90c41bd7f315f (patch) | |
tree | 8ceddee0b37d55ec34e134b8a27bf824da90ced6 /libstdc++-v3/include/debug | |
parent | dd99e942121165eeba51c61e1dcdd3253ca11ef0 (diff) | |
download | gcc-6b9314a80cb4d41e7072d7620ac90c41bd7f315f.tar.gz |
2012-09-24 François Dumont <fdumont@gcc.gnu.org>
PR libstdc++/44436
* include/bits/stl_tree.h
(_Rb_tree<>::_M_insert_): Take _Base_ptr rather than
_Const_Base_ptr.
(_Rb_tree<>::_M_insert_node): New.
(_Rb_tree<>::_M_get_insert_unique_pos): New, search code of
_M_insert_unique method.
(_Rb_tree<>::_M_insert_unique): Use latter.
(_Rb_tree<>::_M_emplace_unique): New, likewise.
(_Rb_tree<>::_M_get_insert_equal_pos): New, search code of
_M_insert_equal method.
(_Rb_tree<>::_M_insert_equal): Use latter.
(_Rb_tree<>::_M_emplace_equal): New, likewise.
(_Rb_tree<>::_M_get_insert_hint_unique_pos): New, search code of
_M_insert_unique_ method.
(_Rb_tree<>::_M_insert_unique_): Use latter.
(_Rb_tree<>::_M_emplace_hint_unique): New, likewise.
(_Rb_tree<>::_M_get_insert_hint_equal_pos): New, search code of
_M_insert_equal_ method.
(_Rb_tree<>::_M_insert_equal_): Use latter.
(_Rb_tree<>::_M_emplace_hint_equal): New, likewise.
(_Rb_tree<>::_M_insert_lower): Remove first _Base_ptr parameter,
useless as always null.
* include/bits/stl_map.h: Include <tuple> in C++11.
(map<>::operator[](const key_type&)): Use
_Rb_tree<>::_M_emplace_hint_unique in C++11.
(map<>::operator[](key_type&&)): Likewise.
(map<>::emplace): New.
(map<>::emplace_hint): New.
* include/bits/stl_multimap.h (multimap<>::emplace): New.
(multimap<>::emplace_hint): New.
* include/bits/stl_set.h (set<>::emplace): New.
(set<>::emplace_hint): New.
* include/bits/stl_multiset.h (multiset<>::emplace): New.
(multiset<>::emplace_hint): New.
* include/debug/map.h (std::__debug::map<>::emplace): New.
(std::__debug::map<>::emplace_hint): New.
* include/debug/multimap.h (std::__debug::multimap<>::emplace):
New.
(std::__debug::multimap<>::emplace_hint): New.
* include/debug/set.h (std::__debug::set<>::emplace): New.
(std::__debug::set<>::emplace_hint): New.
* include/debug/multiset.h (std::__debug::multiset<>::emplace):
New.
(std::__debug::multiset<>::emplace_hint): New.
* include/profile/map.h (std::__profile::map<>::emplace): New.
(std::__profile::map<>::emplace_hint): New.
* include/profile/multimap.h (std::__profile::multimap<>::emplace):
New.
(std::__profile::multimap<>::emplace_hint): New.
* include/profile/set.h (std::__profile::set<>::emplace): New.
(std::__profile::set<>::emplace_hint): New.
* include/profile/multiset.h (std::__profile::multiset<>::emplace):
New.
(std::__profile::multiset<>::emplace_hint): New.
* testsuite/util/testsuite_container_traits.h: Signal that emplace
and emplace_hint are available on std::map, std::multimap,
std::set and std::multiset in C++11.
* testsuite/23_containers/map/operators/2.cc: New.
* testsuite/23_containers/map/modifiers/emplace/1.cc: New.
* testsuite/23_containers/multimap/modifiers/emplace/1.cc: New.
* testsuite/23_containers/set/modifiers/emplace/1.cc: New.
* testsuite/23_containers/multiset/modifiers/emplace/1.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191679 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/debug')
-rw-r--r-- | libstdc++-v3/include/debug/map.h | 21 | ||||
-rw-r--r-- | libstdc++-v3/include/debug/multimap.h | 19 | ||||
-rw-r--r-- | libstdc++-v3/include/debug/multiset.h | 19 | ||||
-rw-r--r-- | libstdc++-v3/include/debug/set.h | 21 |
4 files changed, 80 insertions, 0 deletions
diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h index 95871ac6b73..254988c2c64 100644 --- a/libstdc++-v3/include/debug/map.h +++ b/libstdc++-v3/include/debug/map.h @@ -203,6 +203,27 @@ namespace __debug using _Base::at; // modifiers: +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename... _Args> + std::pair<iterator, bool> + emplace(_Args&&... __args) + { + auto __res = _Base::emplace(std::forward<_Args>(__args)...); + return std::pair<iterator, bool>(iterator(__res.first, this), + __res.second); + } + + template<typename... _Args> + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + __glibcxx_check_insert(__pos); + return iterator(_Base::emplace_hint(__pos.base(), + std::forward<_Args>(__args)...), + this); + } +#endif + std::pair<iterator, bool> insert(const value_type& __x) { diff --git a/libstdc++-v3/include/debug/multimap.h b/libstdc++-v3/include/debug/multimap.h index e1e09bc07af..e46a7427345 100644 --- a/libstdc++-v3/include/debug/multimap.h +++ b/libstdc++-v3/include/debug/multimap.h @@ -195,6 +195,25 @@ namespace __debug using _Base::max_size; // modifiers: +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename... _Args> + iterator + emplace(_Args&&... __args) + { + return iterator(_Base::emplace(std::forward<_Args>(__args)...), this); + } + + template<typename... _Args> + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + __glibcxx_check_insert(__pos); + return iterator(_Base::emplace_hint(__pos.base(), + std::forward<_Args>(__args)...), + this); + } +#endif + iterator insert(const value_type& __x) { return iterator(_Base::insert(__x), this); } diff --git a/libstdc++-v3/include/debug/multiset.h b/libstdc++-v3/include/debug/multiset.h index c7f38eabb40..04598464abd 100644 --- a/libstdc++-v3/include/debug/multiset.h +++ b/libstdc++-v3/include/debug/multiset.h @@ -194,6 +194,25 @@ namespace __debug using _Base::max_size; // modifiers: +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename... _Args> + iterator + emplace(_Args&&... __args) + { + return iterator(_Base::emplace(std::forward<_Args>(__args)...), this); + } + + template<typename... _Args> + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + __glibcxx_check_insert(__pos); + return iterator(_Base::emplace_hint(__pos.base(), + std::forward<_Args>(__args)...), + this); + } +#endif + iterator insert(const value_type& __x) { return iterator(_Base::insert(__x), this); } diff --git a/libstdc++-v3/include/debug/set.h b/libstdc++-v3/include/debug/set.h index d6dc06f9ee2..44cbe941732 100644 --- a/libstdc++-v3/include/debug/set.h +++ b/libstdc++-v3/include/debug/set.h @@ -194,6 +194,27 @@ namespace __debug using _Base::max_size; // modifiers: +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename... _Args> + std::pair<iterator, bool> + emplace(_Args&&... __args) + { + auto __res = _Base::emplace(std::forward<_Args>(__args)...); + return std::pair<iterator, bool>(iterator(__res.first, this), + __res.second); + } + + template<typename... _Args> + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + __glibcxx_check_insert(__pos); + return iterator(_Base::emplace_hint(__pos.base(), + std::forward<_Args>(__args)...), + this); + } +#endif + std::pair<iterator, bool> insert(const value_type& __x) { |