2009-10-03 04:17:41 +02:00
|
|
|
// Profiling multiset implementation -*- C++ -*-
|
|
|
|
|
2015-01-05 13:33:28 +01:00
|
|
|
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
2009-10-03 04:17:41 +02:00
|
|
|
//
|
|
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
|
|
// software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU General Public License as published by the
|
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
|
|
|
// any later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
/** @file profile/multiset.h
|
|
|
|
* This file is a GNU profile extension to the Standard C++ Library.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GLIBCXX_PROFILE_MULTISET_H
|
|
|
|
#define _GLIBCXX_PROFILE_MULTISET_H 1
|
|
|
|
|
2014-05-24 22:59:00 +02:00
|
|
|
#include <profile/base.h>
|
|
|
|
#include <profile/ordered_base.h>
|
2009-10-03 04:17:41 +02:00
|
|
|
|
PR libstdc++/36104 part four
2011-01-30 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/36104 part four
* include/bits/c++config (_GLIBCXX_STD): Remove.
(_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C.
(_GLIBCXX_P): Now _GLIBCXX_STD_A.
(_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL,
_GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove.
(_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL,
_GLIBCXX_INLINE_PROFILE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE(X)): Remove.
(_GLIBCXX_END_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove.
(_GLIBCXX_END_NESTED_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add.
(_GLIBCXX_END_NAMESPACE_ALGO): Add.
(_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_END_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add.
(_GLIBCXX_END_NAMESPACE_VERSION): Add.
(_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL.
(_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL.
(_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY.
* include/*: Use new macros for namespace scope.
* config/*: Same.
* src/*: Same.
* src/Makefile.am (sources): Remove debug_list.cc, add
compatibility-debug_list-2.cc.
(parallel_sources): Remove parallel_list.cc, add
compatibility-parallel_list-2.cc.
(compatibility-parallel_list-2.[o,lo]): New rule.
* src/Makefile.in: Regenerate.
* src/debug_list.cc: Remove.
* src/parallel_list.cc: Remove.
* src/compatibility-list-2.cc: New.
* src/compatibility-debug_list-2.cc: New.
* src/compatibility-parallel_list-2.cc: New.
* doc/doxygen/user.cfg.in: Adjust macros.
* testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros.
* testsuite/20_util/declval/requirements/1_neg.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/forward/c_neg.cc: Same.
* testsuite/20_util/forward/f_neg.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/forward_list/capacity/1.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Same.
* testsuite/23_containers/list/capacity/29134.cc: Same.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Same.
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
* testsuite/25_algorithms/sort/35588.cc: Same.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
* testsuite/ext/profile/mutex_extensions_neg.cc: Same.
* testsuite/ext/profile/profiler_algos.cc: Same.
* testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same.
From-SVN: r169421
2011-01-30 23:39:36 +01:00
|
|
|
namespace std _GLIBCXX_VISIBILITY(default)
|
2009-10-03 04:17:41 +02:00
|
|
|
{
|
|
|
|
namespace __profile
|
|
|
|
{
|
2009-11-17 21:45:32 +01:00
|
|
|
/// Class std::multiset wrapper with performance instrumentation.
|
2009-10-03 04:17:41 +02:00
|
|
|
template<typename _Key, typename _Compare = std::less<_Key>,
|
|
|
|
typename _Allocator = std::allocator<_Key> >
|
|
|
|
class multiset
|
2014-05-24 22:59:00 +02:00
|
|
|
: public _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator>,
|
|
|
|
public _Ordered_profile<multiset<_Key, _Compare, _Allocator> >
|
2009-10-03 04:17:41 +02:00
|
|
|
{
|
PR libstdc++/36104 part four
2011-01-30 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/36104 part four
* include/bits/c++config (_GLIBCXX_STD): Remove.
(_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C.
(_GLIBCXX_P): Now _GLIBCXX_STD_A.
(_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL,
_GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove.
(_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL,
_GLIBCXX_INLINE_PROFILE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE(X)): Remove.
(_GLIBCXX_END_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove.
(_GLIBCXX_END_NESTED_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add.
(_GLIBCXX_END_NAMESPACE_ALGO): Add.
(_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_END_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add.
(_GLIBCXX_END_NAMESPACE_VERSION): Add.
(_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL.
(_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL.
(_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY.
* include/*: Use new macros for namespace scope.
* config/*: Same.
* src/*: Same.
* src/Makefile.am (sources): Remove debug_list.cc, add
compatibility-debug_list-2.cc.
(parallel_sources): Remove parallel_list.cc, add
compatibility-parallel_list-2.cc.
(compatibility-parallel_list-2.[o,lo]): New rule.
* src/Makefile.in: Regenerate.
* src/debug_list.cc: Remove.
* src/parallel_list.cc: Remove.
* src/compatibility-list-2.cc: New.
* src/compatibility-debug_list-2.cc: New.
* src/compatibility-parallel_list-2.cc: New.
* doc/doxygen/user.cfg.in: Adjust macros.
* testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros.
* testsuite/20_util/declval/requirements/1_neg.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/forward/c_neg.cc: Same.
* testsuite/20_util/forward/f_neg.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/forward_list/capacity/1.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Same.
* testsuite/23_containers/list/capacity/29134.cc: Same.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Same.
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
* testsuite/25_algorithms/sort/35588.cc: Same.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
* testsuite/ext/profile/mutex_extensions_neg.cc: Same.
* testsuite/ext/profile/profiler_algos.cc: Same.
* testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same.
From-SVN: r169421
2011-01-30 23:39:36 +01:00
|
|
|
typedef _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> _Base;
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2014-11-10 22:51:58 +01:00
|
|
|
typedef typename _Base::iterator _Base_iterator;
|
|
|
|
typedef typename _Base::const_iterator _Base_const_iterator;
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
public:
|
|
|
|
// types:
|
2014-05-24 22:59:00 +02:00
|
|
|
typedef _Key key_type;
|
|
|
|
typedef _Key value_type;
|
|
|
|
typedef _Compare key_compare;
|
|
|
|
typedef _Compare value_compare;
|
|
|
|
typedef _Allocator allocator_type;
|
|
|
|
typedef typename _Base::reference reference;
|
|
|
|
typedef typename _Base::const_reference const_reference;
|
|
|
|
|
2014-11-10 22:51:58 +01:00
|
|
|
typedef __iterator_tracker<_Base_iterator,
|
|
|
|
multiset> iterator;
|
|
|
|
typedef __iterator_tracker<_Base_const_iterator,
|
|
|
|
multiset> const_iterator;
|
|
|
|
typedef std::reverse_iterator<iterator> reverse_iterator;
|
|
|
|
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
2014-05-24 22:59:00 +02:00
|
|
|
|
|
|
|
typedef typename _Base::size_type size_type;
|
|
|
|
typedef typename _Base::difference_type difference_type;
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
// 23.3.3.1 construct/copy/destroy:
|
2014-01-22 20:46:44 +01:00
|
|
|
|
2014-05-24 22:59:00 +02:00
|
|
|
#if __cplusplus < 201103L
|
2014-01-22 20:46:44 +01:00
|
|
|
multiset()
|
|
|
|
: _Base() { }
|
2014-05-24 22:59:00 +02:00
|
|
|
multiset(const multiset& __x)
|
|
|
|
: _Base(__x) { }
|
|
|
|
~multiset() { }
|
|
|
|
#else
|
|
|
|
multiset() = default;
|
|
|
|
multiset(const multiset&) = default;
|
|
|
|
multiset(multiset&&) = default;
|
|
|
|
~multiset() = default;
|
|
|
|
#endif
|
2014-01-22 20:46:44 +01:00
|
|
|
|
|
|
|
explicit multiset(const _Compare& __comp,
|
2009-10-03 04:17:41 +02:00
|
|
|
const _Allocator& __a = _Allocator())
|
|
|
|
: _Base(__comp, __a) { }
|
|
|
|
|
2012-11-10 18:27:22 +01:00
|
|
|
#if __cplusplus >= 201103L
|
2012-11-06 01:06:42 +01:00
|
|
|
template<typename _InputIterator,
|
|
|
|
typename = std::_RequireInputIter<_InputIterator>>
|
|
|
|
#else
|
2009-10-03 04:17:41 +02:00
|
|
|
template<typename _InputIterator>
|
2012-11-06 01:06:42 +01:00
|
|
|
#endif
|
2014-05-24 22:59:00 +02:00
|
|
|
multiset(_InputIterator __first, _InputIterator __last,
|
2009-10-03 04:17:41 +02:00
|
|
|
const _Compare& __comp = _Compare(),
|
|
|
|
const _Allocator& __a = _Allocator())
|
|
|
|
: _Base(__first, __last, __comp, __a) { }
|
|
|
|
|
2014-05-24 22:59:00 +02:00
|
|
|
#if __cplusplus >= 201103L
|
2009-10-03 04:17:41 +02:00
|
|
|
multiset(initializer_list<value_type> __l,
|
|
|
|
const _Compare& __comp = _Compare(),
|
|
|
|
const allocator_type& __a = allocator_type())
|
|
|
|
: _Base(__l, __comp, __a) { }
|
2014-01-17 22:10:15 +01:00
|
|
|
|
|
|
|
explicit
|
|
|
|
multiset(const allocator_type& __a)
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(__a) { }
|
2014-01-17 22:10:15 +01:00
|
|
|
|
|
|
|
multiset(const multiset& __x, const allocator_type& __a)
|
|
|
|
: _Base(__x, __a) { }
|
|
|
|
|
|
|
|
multiset(multiset&& __x, const allocator_type& __a)
|
2014-05-24 22:59:00 +02:00
|
|
|
noexcept( noexcept(_Base(std::move(__x), __a)) )
|
2014-01-17 22:10:15 +01:00
|
|
|
: _Base(std::move(__x), __a) { }
|
|
|
|
|
|
|
|
multiset(initializer_list<value_type> __l, const allocator_type& __a)
|
|
|
|
: _Base(__l, __a) { }
|
|
|
|
|
|
|
|
template<typename _InputIterator>
|
2014-05-24 22:59:00 +02:00
|
|
|
multiset(_InputIterator __first, _InputIterator __last,
|
|
|
|
const allocator_type& __a)
|
|
|
|
: _Base(__first, __last, __a) { }
|
2009-10-03 04:17:41 +02:00
|
|
|
#endif
|
|
|
|
|
2014-01-17 22:10:15 +01:00
|
|
|
multiset(const _Base& __x)
|
|
|
|
: _Base(__x) { }
|
|
|
|
|
|
|
|
#if __cplusplus < 201103L
|
2009-10-03 04:17:41 +02:00
|
|
|
multiset&
|
|
|
|
operator=(const multiset& __x)
|
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_destruct();
|
2014-01-17 22:10:15 +01:00
|
|
|
_M_base() = __x;
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_construct();
|
2009-10-03 04:17:41 +02:00
|
|
|
return *this;
|
|
|
|
}
|
2014-01-17 22:10:15 +01:00
|
|
|
#else
|
|
|
|
multiset&
|
|
|
|
operator=(const multiset&) = default;
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
multiset&
|
2014-01-17 22:10:15 +01:00
|
|
|
operator=(multiset&&) = default;
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
multiset&
|
|
|
|
operator=(initializer_list<value_type> __l)
|
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_destruct();
|
2014-01-17 22:10:15 +01:00
|
|
|
_M_base() = __l;
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_construct();
|
2009-10-03 04:17:41 +02:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-11-10 22:51:58 +01:00
|
|
|
// iterators
|
|
|
|
iterator
|
|
|
|
begin() _GLIBCXX_NOEXCEPT
|
|
|
|
{ return iterator(_Base::begin(), this); }
|
|
|
|
|
|
|
|
const_iterator
|
|
|
|
begin() const _GLIBCXX_NOEXCEPT
|
|
|
|
{ return const_iterator(_Base::begin(), this); }
|
|
|
|
|
|
|
|
iterator
|
|
|
|
end() _GLIBCXX_NOEXCEPT
|
|
|
|
{ return iterator(_Base::end(), this); }
|
|
|
|
|
|
|
|
const_iterator
|
|
|
|
end() const _GLIBCXX_NOEXCEPT
|
|
|
|
{ return const_iterator(_Base::end(), this); }
|
|
|
|
|
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
const_iterator
|
|
|
|
cbegin() const noexcept
|
|
|
|
{ return const_iterator(_Base::cbegin(), this); }
|
|
|
|
|
|
|
|
const_iterator
|
|
|
|
cend() const noexcept
|
|
|
|
{ return const_iterator(_Base::cend(), this); }
|
|
|
|
#endif
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
reverse_iterator
|
2011-05-26 17:35:02 +02:00
|
|
|
rbegin() _GLIBCXX_NOEXCEPT
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
|
|
|
return reverse_iterator(end());
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
const_reverse_iterator
|
2011-05-26 17:35:02 +02:00
|
|
|
rbegin() const _GLIBCXX_NOEXCEPT
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
|
|
|
return const_reverse_iterator(end());
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
reverse_iterator
|
2011-05-26 17:35:02 +02:00
|
|
|
rend() _GLIBCXX_NOEXCEPT
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
|
|
|
return reverse_iterator(begin());
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
const_reverse_iterator
|
2011-05-26 17:35:02 +02:00
|
|
|
rend() const _GLIBCXX_NOEXCEPT
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
|
|
|
return const_reverse_iterator(begin());
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2012-11-10 18:27:22 +01:00
|
|
|
#if __cplusplus >= 201103L
|
2009-10-03 04:17:41 +02:00
|
|
|
const_reverse_iterator
|
2011-05-26 17:35:02 +02:00
|
|
|
crbegin() const noexcept
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
|
|
|
return const_reverse_iterator(cend());
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
const_reverse_iterator
|
2011-05-26 17:35:02 +02:00
|
|
|
crend() const noexcept
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
|
|
|
return const_reverse_iterator(cbegin());
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
#endif
|
|
|
|
|
2014-11-10 22:51:58 +01:00
|
|
|
void
|
|
|
|
swap(multiset& __x)
|
c++config (_GLIBCXX_NOEXCEPT_IF): Define.
* include/bits/c++config (_GLIBCXX_NOEXCEPT_IF): Define.
* include/bits/forward_list.h (forward_list::swap): Make noexcept
unconditional.
* include/bits/hashtable.h (_Hashtable::swap): Do not use
_S_nothrow_swap().
* include/bits/stl_bvector.h (vector<bool>::swap): Make noexcept
unconditional.
* include/bits/stl_deque.h (deque::swap): Likewise.
(swap(deque&, deque&)): Use _GLIBCXX_NOEXCEPT_IF.
* include/bits/stl_list.h (list::swap): Make noexcept unconditional.
(swap(list&, list&)): Use _GLIBCXX_NOEXCEPT_IF.
* include/bits/stl_map.h (map::swap, swap(map&, map&)): Use
_GLIBCXX_NOEXCEPT_IF, do not depend on _S_nothrow_swap.
* include/bits/stl_multimap.h (multimap::swap,
swap(multimap&, multimap&)): Likewise.
* include/bits/stl_multiset.h (multiset::swap,
swap(multiset&, multiset&)): Likewise.
* include/bits/stl_set.h (set::swap, swap(set&, set&)): Likewise.
* include/bits/stl_tree.h (_Rb_tree::swap,
swap(_Rb_tree&, _Rb_tree&)): Likewise.
* include/bits/stl_vector.h (vector::swap): Make noexcept
unconditional.
(swap(vector&, vector&)): Use _GLIBCXX_NOEXCEPT_IF.
* include/debug/deque (deque::swap, swap): Likewise.
* include/debug/forward_list (swap): Add noexcept.
* include/debug/list (list::swap, swap): Use _GLIBCXX_NOEXCEPT_IF.
* include/debug/map.h (map::swap, swap): Likewise.
* include/debug/multimap.h (multimap::swap, swap): Likewise.
* include/debug/multiset.h (multiset::Swap, swap): Likewise.
* include/debug/set.h (set::swap, swap): Likewise.
* include/debug/unordered_map (unordered_map::swap,
unordered_multimap::swap, swap): Likewise.
* include/debug/unordered_set (unordered_set::swap,
unordered_multiset::swap, swap): Likewise.
* include/debug/vector (vector::swap, swap): Likewise.
* include/ext/alloc_traits.h (__alloc_traits::_S_nothrow_swap()):
Remove.
* include/profile/deque (deque::swap, swap): Use _GLIBCXX_NOEXCEPT_IF.
* include/profile/forward_list (swap): Add noexcept.
* include/profile/list (list::swap, swap) : Use _GLIBCXX_NOEXCEPT_IF.
* include/profile/map.h (map::swap, swap): Likewise.
* include/profile/multimap.h (multimap::swap, swap): Likewise.
* include/profile/multiset.h (multiset::swap, swap): Likewise.
* include/profile/set.h (set::swap, swap): Likewise.
* include/profile/unordered_map (swap): Likewise.
* include/profile/unordered_set (swap): Likewise.
* include/profile/vector (vector::swap, swap): Likewise. Remove
overloads for swapping rvalues.
* testsuite/23_containers/deque/allocator/noexcept.cc: Update tests
for noexcept on swap.
* testsuite/23_containers/forward_list/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/list/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/map/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/multimap/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/multiset/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/set/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/unordered_map/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_set/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/vector/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/vector/bool/allocator/noexcept.cc: Likewise.
* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error line
number.
From-SVN: r225744
2015-07-13 19:15:48 +02:00
|
|
|
_GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
|
2014-11-10 22:51:58 +01:00
|
|
|
{
|
|
|
|
_Base::swap(__x);
|
|
|
|
this->_M_swap(__x);
|
|
|
|
}
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
// modifiers:
|
2012-11-10 18:27:22 +01:00
|
|
|
#if __cplusplus >= 201103L
|
re PR libstdc++/44436 ([C++0x] Implement emplace* in associative containers)
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.
From-SVN: r191679
2012-09-24 21:53:36 +02:00
|
|
|
template<typename... _Args>
|
|
|
|
iterator
|
|
|
|
emplace(_Args&&... __args)
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
|
|
|
// The cost is the same whether or not the element is inserted so we
|
|
|
|
// always report insertion of 1 element.
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
|
|
|
return iterator(_Base::emplace(std::forward<_Args>(__args)...), this);
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
re PR libstdc++/44436 ([C++0x] Implement emplace* in associative containers)
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.
From-SVN: r191679
2012-09-24 21:53:36 +02:00
|
|
|
|
|
|
|
template<typename... _Args>
|
|
|
|
iterator
|
|
|
|
emplace_hint(const_iterator __pos, _Args&&... __args)
|
|
|
|
{
|
2014-05-24 22:59:00 +02:00
|
|
|
auto size_before = this->size();
|
2014-11-10 22:51:58 +01:00
|
|
|
auto __res
|
|
|
|
= _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...);
|
|
|
|
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
|
|
|
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
|
|
|
return iterator(__res, this);
|
re PR libstdc++/44436 ([C++0x] Implement emplace* in associative containers)
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.
From-SVN: r191679
2012-09-24 21:53:36 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
iterator
|
|
|
|
insert(const value_type& __x)
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
|
|
|
return iterator(_Base::insert(__x), this);
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2012-11-10 18:27:22 +01:00
|
|
|
#if __cplusplus >= 201103L
|
PR libstdc++/44436 (partial)
2010-11-10 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/44436 (partial)
PR libstdc++/46148
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert_, _M_insert_lower,
_M_insert_equal_lower, _M_insert_unique, _M_insert_equal,
_M_insert_unique_, _M_insert_equal_): Templatize in C++0x mode,
use _GLIBCXX_FORWARD throughout.
* include/bits/stl_map.h (map<>::insert(_Pair&&),
insert(const_iterator, _Pair&&), operator[](key_type&&): Add.
* include/bits/stl_set.h (set<>::insert(value_type&&),
insert(const_iterator, value_type&&)): Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(_Pair&&),
insert(const_iterator, _Pair&&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(value_type&&),
insert(const_iterator, value_type&&)): Likewise.
* include/debug/set.h: Adjust.
* include/debug/multiset.h: Likewise.
* include/debug/map.h: Likewise.
* include/debug/multimap.h: Likewise.
* include/profile/set.h: Likewise.
* include/profile/multiset.h: Likewise.
* include/profile/map.h: Likewise.
* include/profile/multimap.h: Likewise.
* testsuite/23_containers/multimap/modifiers/insert/1.cc: New.
* testsuite/23_containers/multimap/modifiers/insert/2.cc: Likewise.
* testsuite/23_containers/multimap/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/multimap/modifiers/insert/4.cc: Likewise.
* testsuite/23_containers/set/modifiers/insert/2.cc: Likewise.
* testsuite/23_containers/set/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/multiset/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/multiset/modifiers/insert/4.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/2.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/4.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/5.cc: Likewise.
* testsuite/23_containers/map/element_access/2.cc: Likewise.
* testsuite/23_containers/map/element_access/46148.cc: Likewise.
* include/bits/hashtable.h: Trivial naming changes.
From-SVN: r166551
2010-11-10 20:08:49 +01:00
|
|
|
iterator
|
|
|
|
insert(value_type&& __x)
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_insert(this->_M_map2umap_info, this->size(), 1);
|
|
|
|
return iterator(_Base::insert(std::move(__x)), this);
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
PR libstdc++/44436 (partial)
2010-11-10 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/44436 (partial)
PR libstdc++/46148
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert_, _M_insert_lower,
_M_insert_equal_lower, _M_insert_unique, _M_insert_equal,
_M_insert_unique_, _M_insert_equal_): Templatize in C++0x mode,
use _GLIBCXX_FORWARD throughout.
* include/bits/stl_map.h (map<>::insert(_Pair&&),
insert(const_iterator, _Pair&&), operator[](key_type&&): Add.
* include/bits/stl_set.h (set<>::insert(value_type&&),
insert(const_iterator, value_type&&)): Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(_Pair&&),
insert(const_iterator, _Pair&&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(value_type&&),
insert(const_iterator, value_type&&)): Likewise.
* include/debug/set.h: Adjust.
* include/debug/multiset.h: Likewise.
* include/debug/map.h: Likewise.
* include/debug/multimap.h: Likewise.
* include/profile/set.h: Likewise.
* include/profile/multiset.h: Likewise.
* include/profile/map.h: Likewise.
* include/profile/multimap.h: Likewise.
* testsuite/23_containers/multimap/modifiers/insert/1.cc: New.
* testsuite/23_containers/multimap/modifiers/insert/2.cc: Likewise.
* testsuite/23_containers/multimap/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/multimap/modifiers/insert/4.cc: Likewise.
* testsuite/23_containers/set/modifiers/insert/2.cc: Likewise.
* testsuite/23_containers/set/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/multiset/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/multiset/modifiers/insert/4.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/2.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/4.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/5.cc: Likewise.
* testsuite/23_containers/map/element_access/2.cc: Likewise.
* testsuite/23_containers/map/element_access/46148.cc: Likewise.
* include/bits/hashtable.h: Trivial naming changes.
From-SVN: r166551
2010-11-10 20:08:49 +01:00
|
|
|
#endif
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
iterator
|
2014-05-24 22:59:00 +02:00
|
|
|
insert(const_iterator __pos, const value_type& __x)
|
|
|
|
{
|
|
|
|
size_type size_before = this->size();
|
2014-11-10 22:51:58 +01:00
|
|
|
_Base_iterator __res = _Base::insert(__pos.base(), __x);
|
2014-05-24 22:59:00 +02:00
|
|
|
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
|
|
|
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
|
|
|
return iterator(__res, this);
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2012-11-10 18:27:22 +01:00
|
|
|
#if __cplusplus >= 201103L
|
PR libstdc++/44436 (partial)
2010-11-10 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/44436 (partial)
PR libstdc++/46148
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert_, _M_insert_lower,
_M_insert_equal_lower, _M_insert_unique, _M_insert_equal,
_M_insert_unique_, _M_insert_equal_): Templatize in C++0x mode,
use _GLIBCXX_FORWARD throughout.
* include/bits/stl_map.h (map<>::insert(_Pair&&),
insert(const_iterator, _Pair&&), operator[](key_type&&): Add.
* include/bits/stl_set.h (set<>::insert(value_type&&),
insert(const_iterator, value_type&&)): Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(_Pair&&),
insert(const_iterator, _Pair&&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(value_type&&),
insert(const_iterator, value_type&&)): Likewise.
* include/debug/set.h: Adjust.
* include/debug/multiset.h: Likewise.
* include/debug/map.h: Likewise.
* include/debug/multimap.h: Likewise.
* include/profile/set.h: Likewise.
* include/profile/multiset.h: Likewise.
* include/profile/map.h: Likewise.
* include/profile/multimap.h: Likewise.
* testsuite/23_containers/multimap/modifiers/insert/1.cc: New.
* testsuite/23_containers/multimap/modifiers/insert/2.cc: Likewise.
* testsuite/23_containers/multimap/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/multimap/modifiers/insert/4.cc: Likewise.
* testsuite/23_containers/set/modifiers/insert/2.cc: Likewise.
* testsuite/23_containers/set/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/multiset/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/multiset/modifiers/insert/4.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/2.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/4.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/5.cc: Likewise.
* testsuite/23_containers/map/element_access/2.cc: Likewise.
* testsuite/23_containers/map/element_access/46148.cc: Likewise.
* include/bits/hashtable.h: Trivial naming changes.
From-SVN: r166551
2010-11-10 20:08:49 +01:00
|
|
|
iterator
|
2014-05-24 22:59:00 +02:00
|
|
|
insert(const_iterator __pos, value_type&& __x)
|
|
|
|
{
|
|
|
|
auto size_before = this->size();
|
2014-11-10 22:51:58 +01:00
|
|
|
auto __res = _Base::insert(__pos.base(), std::move(__x));
|
|
|
|
__profcxx_map2umap_insert(this->_M_map2umap_info,
|
|
|
|
size_before, _M_hint_used(__pos.base(), __res) ? 0 : 1);
|
|
|
|
return iterator(__res, this);
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
PR libstdc++/44436 (partial)
2010-11-10 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/44436 (partial)
PR libstdc++/46148
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert_, _M_insert_lower,
_M_insert_equal_lower, _M_insert_unique, _M_insert_equal,
_M_insert_unique_, _M_insert_equal_): Templatize in C++0x mode,
use _GLIBCXX_FORWARD throughout.
* include/bits/stl_map.h (map<>::insert(_Pair&&),
insert(const_iterator, _Pair&&), operator[](key_type&&): Add.
* include/bits/stl_set.h (set<>::insert(value_type&&),
insert(const_iterator, value_type&&)): Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(_Pair&&),
insert(const_iterator, _Pair&&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(value_type&&),
insert(const_iterator, value_type&&)): Likewise.
* include/debug/set.h: Adjust.
* include/debug/multiset.h: Likewise.
* include/debug/map.h: Likewise.
* include/debug/multimap.h: Likewise.
* include/profile/set.h: Likewise.
* include/profile/multiset.h: Likewise.
* include/profile/map.h: Likewise.
* include/profile/multimap.h: Likewise.
* testsuite/23_containers/multimap/modifiers/insert/1.cc: New.
* testsuite/23_containers/multimap/modifiers/insert/2.cc: Likewise.
* testsuite/23_containers/multimap/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/multimap/modifiers/insert/4.cc: Likewise.
* testsuite/23_containers/set/modifiers/insert/2.cc: Likewise.
* testsuite/23_containers/set/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/multiset/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/multiset/modifiers/insert/4.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/2.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/3.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/4.cc: Likewise.
* testsuite/23_containers/map/modifiers/insert/5.cc: Likewise.
* testsuite/23_containers/map/element_access/2.cc: Likewise.
* testsuite/23_containers/map/element_access/46148.cc: Likewise.
* include/bits/hashtable.h: Trivial naming changes.
From-SVN: r166551
2010-11-10 20:08:49 +01:00
|
|
|
#endif
|
|
|
|
|
2012-11-10 18:27:22 +01:00
|
|
|
#if __cplusplus >= 201103L
|
2012-11-06 01:06:42 +01:00
|
|
|
template<typename _InputIterator,
|
|
|
|
typename = std::_RequireInputIter<_InputIterator>>
|
|
|
|
#else
|
2009-10-03 04:17:41 +02:00
|
|
|
template<typename _InputIterator>
|
2012-11-06 01:06:42 +01:00
|
|
|
#endif
|
2014-05-24 22:59:00 +02:00
|
|
|
void
|
|
|
|
insert(_InputIterator __first, _InputIterator __last)
|
|
|
|
{
|
|
|
|
for (; __first != __last; ++__first)
|
|
|
|
insert(*__first);
|
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2012-11-10 18:27:22 +01:00
|
|
|
#if __cplusplus >= 201103L
|
2009-10-03 04:17:41 +02:00
|
|
|
void
|
|
|
|
insert(initializer_list<value_type> __l)
|
2014-05-24 22:59:00 +02:00
|
|
|
{ insert(__l.begin(), __l.end()); }
|
2009-10-03 04:17:41 +02:00
|
|
|
#endif
|
|
|
|
|
2012-11-10 18:27:22 +01:00
|
|
|
#if __cplusplus >= 201103L
|
2009-10-03 04:17:41 +02:00
|
|
|
iterator
|
2014-05-24 22:59:00 +02:00
|
|
|
erase(const_iterator __pos)
|
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
|
|
|
return iterator(_Base::erase(__pos.base()), this);
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
#else
|
|
|
|
void
|
2014-05-24 22:59:00 +02:00
|
|
|
erase(iterator __pos)
|
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
|
|
|
_Base::erase(__pos.base());
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
size_type
|
|
|
|
erase(const key_type& __x)
|
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
__profcxx_map2umap_erase(this->_M_map2umap_info, this->size(), 1);
|
2014-05-24 22:59:00 +02:00
|
|
|
return _Base::erase(__x);
|
2009-10-03 04:17:41 +02:00
|
|
|
}
|
|
|
|
|
2012-11-10 18:27:22 +01:00
|
|
|
#if __cplusplus >= 201103L
|
2010-01-03 21:30:28 +01:00
|
|
|
iterator
|
2010-11-08 17:07:32 +01:00
|
|
|
erase(const_iterator __first, const_iterator __last)
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
|
|
|
if (__first != __last)
|
|
|
|
{
|
|
|
|
iterator __ret;
|
|
|
|
for (; __first != __last;)
|
|
|
|
__ret = erase(__first++);
|
|
|
|
return __ret;
|
|
|
|
}
|
|
|
|
else
|
2014-11-10 22:51:58 +01:00
|
|
|
return iterator(_Base::erase(__first.base(), __last.base()), this);
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2010-01-03 21:30:28 +01:00
|
|
|
#else
|
2009-10-03 04:17:41 +02:00
|
|
|
void
|
|
|
|
erase(iterator __first, iterator __last)
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
|
|
|
for (; __first != __last;)
|
|
|
|
erase(__first++);
|
|
|
|
}
|
2010-01-03 21:30:28 +01:00
|
|
|
#endif
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
void
|
2014-11-10 22:51:58 +01:00
|
|
|
clear() _GLIBCXX_NOEXCEPT
|
|
|
|
{
|
|
|
|
this->_M_profile_destruct();
|
|
|
|
_Base::clear();
|
|
|
|
this->_M_profile_construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
size_type
|
|
|
|
count(const key_type& __x) const
|
|
|
|
{
|
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
return _Base::count(__x);
|
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
stl_tree.h (_Rb_tree<>::__is_transparent<>): Move to outer scope and rename to ...
2015-06-07 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_tree.h (_Rb_tree<>::__is_transparent<>): Move to
outer scope and rename to ...
(std::__hash_is_transparent<>): ... this.
* include/debug/stl_map.h (map::find<>,
map::lower_bound<>, map::upper_bound<>, map::equal_range<>): New
member function templates to perform heterogeneous lookup.
* include/debug/stl_multimap.h (multimap::find<>,
multimap::lower_bound<>, multimap::upper_bound<>,
multimap::equal_range<>): Likewise.
* include/debug/stl_multiset.h (multiset::find<>,
multiset::lower_bound<>, multiset::upper_bound<>,
multiset::equal_range<>): Likewise.
* include/debug/stl_set.h (set::find<>,
set::lower_bound<>, set::upper_bound<>, set::equal_range<>): Likewise.
* include/profile/stl_map.h (map::find<>, map::count<>,
map::lower_bound<>, map::upper_bound<>, map::equal_range<>): Likewise.
* include/profile/stl_multimap.h (multimap::find<>, multimap::count<>,
multimap::lower_bound<>, multimap::upper_bound<>,
multimap::equal_range<>): Likewise.
* include/profile/stl_multiset.h (multiset::find<>, multiset::count<>,
multiset::lower_bound<>, multiset::upper_bound<>,
multiset::equal_range<>): Likewise.
* include/profile/stl_set.h (set::find<>, set::count<>,
set::lower_bound<>, set::upper_bound<>, set::equal_range<>): Likewise.
* testsuite/23_containers/map/operations/1.cc: Check const variants.
* testsuite/23_containers/multimap/operations/1.cc: Likewise.
* testsuite/23_containers/multiset/operations/1.cc: Likewise.
* testsuite/23_containers/set/operations/1.cc: Likewise.
From-SVN: r224200
2015-06-07 22:45:57 +02:00
|
|
|
#if __cplusplus > 201103L
|
|
|
|
template<typename _Kt,
|
|
|
|
typename _Req =
|
|
|
|
typename __has_is_transparent<_Compare, _Kt>::type>
|
|
|
|
size_type
|
|
|
|
count(const _Kt& __x) const
|
|
|
|
{
|
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
return _Base::count(__x);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
// multiset operations:
|
|
|
|
iterator
|
|
|
|
find(const key_type& __x)
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
return iterator(_Base::find(__x), this);
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 214. set::find() missing const overload
|
|
|
|
const_iterator
|
|
|
|
find(const key_type& __x) const
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
return const_iterator(_Base::find(__x), this);
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
stl_tree.h (_Rb_tree<>::__is_transparent<>): Move to outer scope and rename to ...
2015-06-07 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_tree.h (_Rb_tree<>::__is_transparent<>): Move to
outer scope and rename to ...
(std::__hash_is_transparent<>): ... this.
* include/debug/stl_map.h (map::find<>,
map::lower_bound<>, map::upper_bound<>, map::equal_range<>): New
member function templates to perform heterogeneous lookup.
* include/debug/stl_multimap.h (multimap::find<>,
multimap::lower_bound<>, multimap::upper_bound<>,
multimap::equal_range<>): Likewise.
* include/debug/stl_multiset.h (multiset::find<>,
multiset::lower_bound<>, multiset::upper_bound<>,
multiset::equal_range<>): Likewise.
* include/debug/stl_set.h (set::find<>,
set::lower_bound<>, set::upper_bound<>, set::equal_range<>): Likewise.
* include/profile/stl_map.h (map::find<>, map::count<>,
map::lower_bound<>, map::upper_bound<>, map::equal_range<>): Likewise.
* include/profile/stl_multimap.h (multimap::find<>, multimap::count<>,
multimap::lower_bound<>, multimap::upper_bound<>,
multimap::equal_range<>): Likewise.
* include/profile/stl_multiset.h (multiset::find<>, multiset::count<>,
multiset::lower_bound<>, multiset::upper_bound<>,
multiset::equal_range<>): Likewise.
* include/profile/stl_set.h (set::find<>, set::count<>,
set::lower_bound<>, set::upper_bound<>, set::equal_range<>): Likewise.
* testsuite/23_containers/map/operations/1.cc: Check const variants.
* testsuite/23_containers/multimap/operations/1.cc: Likewise.
* testsuite/23_containers/multiset/operations/1.cc: Likewise.
* testsuite/23_containers/set/operations/1.cc: Likewise.
From-SVN: r224200
2015-06-07 22:45:57 +02:00
|
|
|
#if __cplusplus > 201103L
|
|
|
|
template<typename _Kt,
|
|
|
|
typename _Req =
|
|
|
|
typename __has_is_transparent<_Compare, _Kt>::type>
|
|
|
|
iterator
|
|
|
|
find(const _Kt& __x)
|
|
|
|
{
|
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
return { _Base::find(__x), this };
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Kt,
|
|
|
|
typename _Req =
|
|
|
|
typename __has_is_transparent<_Compare, _Kt>::type>
|
|
|
|
const_iterator
|
|
|
|
find(const _Kt& __x) const
|
|
|
|
{
|
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
return { _Base::find(__x), this };
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
iterator
|
|
|
|
lower_bound(const key_type& __x)
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
return iterator(_Base::lower_bound(__x), this);
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 214. set::find() missing const overload
|
|
|
|
const_iterator
|
|
|
|
lower_bound(const key_type& __x) const
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
|
|
|
return const_iterator(_Base::lower_bound(__x), this);
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
stl_tree.h (_Rb_tree<>::__is_transparent<>): Move to outer scope and rename to ...
2015-06-07 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_tree.h (_Rb_tree<>::__is_transparent<>): Move to
outer scope and rename to ...
(std::__hash_is_transparent<>): ... this.
* include/debug/stl_map.h (map::find<>,
map::lower_bound<>, map::upper_bound<>, map::equal_range<>): New
member function templates to perform heterogeneous lookup.
* include/debug/stl_multimap.h (multimap::find<>,
multimap::lower_bound<>, multimap::upper_bound<>,
multimap::equal_range<>): Likewise.
* include/debug/stl_multiset.h (multiset::find<>,
multiset::lower_bound<>, multiset::upper_bound<>,
multiset::equal_range<>): Likewise.
* include/debug/stl_set.h (set::find<>,
set::lower_bound<>, set::upper_bound<>, set::equal_range<>): Likewise.
* include/profile/stl_map.h (map::find<>, map::count<>,
map::lower_bound<>, map::upper_bound<>, map::equal_range<>): Likewise.
* include/profile/stl_multimap.h (multimap::find<>, multimap::count<>,
multimap::lower_bound<>, multimap::upper_bound<>,
multimap::equal_range<>): Likewise.
* include/profile/stl_multiset.h (multiset::find<>, multiset::count<>,
multiset::lower_bound<>, multiset::upper_bound<>,
multiset::equal_range<>): Likewise.
* include/profile/stl_set.h (set::find<>, set::count<>,
set::lower_bound<>, set::upper_bound<>, set::equal_range<>): Likewise.
* testsuite/23_containers/map/operations/1.cc: Check const variants.
* testsuite/23_containers/multimap/operations/1.cc: Likewise.
* testsuite/23_containers/multiset/operations/1.cc: Likewise.
* testsuite/23_containers/set/operations/1.cc: Likewise.
From-SVN: r224200
2015-06-07 22:45:57 +02:00
|
|
|
#if __cplusplus > 201103L
|
|
|
|
template<typename _Kt,
|
|
|
|
typename _Req =
|
|
|
|
typename __has_is_transparent<_Compare, _Kt>::type>
|
|
|
|
iterator
|
|
|
|
lower_bound(const _Kt& __x)
|
|
|
|
{
|
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
|
|
|
return { _Base::lower_bound(__x), this };
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Kt,
|
|
|
|
typename _Req =
|
|
|
|
typename __has_is_transparent<_Compare, _Kt>::type>
|
|
|
|
const_iterator
|
|
|
|
lower_bound(const _Kt& __x) const
|
|
|
|
{
|
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
|
|
|
return { _Base::lower_bound(__x), this };
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
iterator
|
|
|
|
upper_bound(const key_type& __x)
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
|
|
|
return iterator(_Base::upper_bound(__x), this);
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 214. set::find() missing const overload
|
|
|
|
const_iterator
|
|
|
|
upper_bound(const key_type& __x) const
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
|
|
|
return const_iterator(_Base::upper_bound(__x), this);
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
stl_tree.h (_Rb_tree<>::__is_transparent<>): Move to outer scope and rename to ...
2015-06-07 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_tree.h (_Rb_tree<>::__is_transparent<>): Move to
outer scope and rename to ...
(std::__hash_is_transparent<>): ... this.
* include/debug/stl_map.h (map::find<>,
map::lower_bound<>, map::upper_bound<>, map::equal_range<>): New
member function templates to perform heterogeneous lookup.
* include/debug/stl_multimap.h (multimap::find<>,
multimap::lower_bound<>, multimap::upper_bound<>,
multimap::equal_range<>): Likewise.
* include/debug/stl_multiset.h (multiset::find<>,
multiset::lower_bound<>, multiset::upper_bound<>,
multiset::equal_range<>): Likewise.
* include/debug/stl_set.h (set::find<>,
set::lower_bound<>, set::upper_bound<>, set::equal_range<>): Likewise.
* include/profile/stl_map.h (map::find<>, map::count<>,
map::lower_bound<>, map::upper_bound<>, map::equal_range<>): Likewise.
* include/profile/stl_multimap.h (multimap::find<>, multimap::count<>,
multimap::lower_bound<>, multimap::upper_bound<>,
multimap::equal_range<>): Likewise.
* include/profile/stl_multiset.h (multiset::find<>, multiset::count<>,
multiset::lower_bound<>, multiset::upper_bound<>,
multiset::equal_range<>): Likewise.
* include/profile/stl_set.h (set::find<>, set::count<>,
set::lower_bound<>, set::upper_bound<>, set::equal_range<>): Likewise.
* testsuite/23_containers/map/operations/1.cc: Check const variants.
* testsuite/23_containers/multimap/operations/1.cc: Likewise.
* testsuite/23_containers/multiset/operations/1.cc: Likewise.
* testsuite/23_containers/set/operations/1.cc: Likewise.
From-SVN: r224200
2015-06-07 22:45:57 +02:00
|
|
|
#if __cplusplus > 201103L
|
|
|
|
template<typename _Kt,
|
|
|
|
typename _Req =
|
|
|
|
typename __has_is_transparent<_Compare, _Kt>::type>
|
|
|
|
iterator
|
|
|
|
upper_bound(const _Kt& __x)
|
|
|
|
{
|
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
|
|
|
return { _Base::upper_bound(__x), this };
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Kt,
|
|
|
|
typename _Req =
|
|
|
|
typename __has_is_transparent<_Compare, _Kt>::type>
|
|
|
|
const_iterator
|
|
|
|
upper_bound(const _Kt& __x) const
|
|
|
|
{
|
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
__profcxx_map2umap_invalidate(this->_M_map2umap_info);
|
|
|
|
return { _Base::upper_bound(__x), this };
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
std::pair<iterator,iterator>
|
|
|
|
equal_range(const key_type& __x)
|
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
std::pair<_Base_iterator, _Base_iterator> __base_ret
|
|
|
|
= _Base::equal_range(__x);
|
|
|
|
return std::make_pair(iterator(__base_ret.first, this),
|
|
|
|
iterator(__base_ret.second, this));
|
2009-10-03 04:17:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 214. set::find() missing const overload
|
|
|
|
std::pair<const_iterator,const_iterator>
|
|
|
|
equal_range(const key_type& __x) const
|
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
std::pair<_Base_const_iterator, _Base_const_iterator> __base_ret
|
|
|
|
= _Base::equal_range(__x);
|
|
|
|
return std::make_pair(const_iterator(__base_ret.first, this),
|
|
|
|
const_iterator(__base_ret.second, this));
|
2009-10-03 04:17:41 +02:00
|
|
|
}
|
|
|
|
|
stl_tree.h (_Rb_tree<>::__is_transparent<>): Move to outer scope and rename to ...
2015-06-07 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_tree.h (_Rb_tree<>::__is_transparent<>): Move to
outer scope and rename to ...
(std::__hash_is_transparent<>): ... this.
* include/debug/stl_map.h (map::find<>,
map::lower_bound<>, map::upper_bound<>, map::equal_range<>): New
member function templates to perform heterogeneous lookup.
* include/debug/stl_multimap.h (multimap::find<>,
multimap::lower_bound<>, multimap::upper_bound<>,
multimap::equal_range<>): Likewise.
* include/debug/stl_multiset.h (multiset::find<>,
multiset::lower_bound<>, multiset::upper_bound<>,
multiset::equal_range<>): Likewise.
* include/debug/stl_set.h (set::find<>,
set::lower_bound<>, set::upper_bound<>, set::equal_range<>): Likewise.
* include/profile/stl_map.h (map::find<>, map::count<>,
map::lower_bound<>, map::upper_bound<>, map::equal_range<>): Likewise.
* include/profile/stl_multimap.h (multimap::find<>, multimap::count<>,
multimap::lower_bound<>, multimap::upper_bound<>,
multimap::equal_range<>): Likewise.
* include/profile/stl_multiset.h (multiset::find<>, multiset::count<>,
multiset::lower_bound<>, multiset::upper_bound<>,
multiset::equal_range<>): Likewise.
* include/profile/stl_set.h (set::find<>, set::count<>,
set::lower_bound<>, set::upper_bound<>, set::equal_range<>): Likewise.
* testsuite/23_containers/map/operations/1.cc: Check const variants.
* testsuite/23_containers/multimap/operations/1.cc: Likewise.
* testsuite/23_containers/multiset/operations/1.cc: Likewise.
* testsuite/23_containers/set/operations/1.cc: Likewise.
From-SVN: r224200
2015-06-07 22:45:57 +02:00
|
|
|
#if __cplusplus > 201103L
|
|
|
|
template<typename _Kt,
|
|
|
|
typename _Req =
|
|
|
|
typename __has_is_transparent<_Compare, _Kt>::type>
|
|
|
|
std::pair<iterator, iterator>
|
|
|
|
equal_range(const _Kt& __x)
|
|
|
|
{
|
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
auto __res = _Base::equal_range(__x);
|
|
|
|
return { { __res.first, this }, { __res.second, this } };
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Kt,
|
|
|
|
typename _Req =
|
|
|
|
typename __has_is_transparent<_Compare, _Kt>::type>
|
|
|
|
std::pair<const_iterator, const_iterator>
|
|
|
|
equal_range(const _Kt& __x) const
|
|
|
|
{
|
|
|
|
__profcxx_map2umap_find(this->_M_map2umap_info, this->size());
|
|
|
|
auto __res = _Base::equal_range(__x);
|
|
|
|
return { { __res.first, this }, { __res.second, this } };
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
_Base&
|
2014-05-24 22:59:00 +02:00
|
|
|
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
const _Base&
|
2014-05-24 22:59:00 +02:00
|
|
|
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
/** If hint is used we consider that the map and unordered_map
|
|
|
|
* operations have equivalent insertion cost so we do not update metrics
|
|
|
|
* about it.
|
|
|
|
* Note that to find out if hint has been used is libstdc++
|
2014-05-25 10:38:01 +02:00
|
|
|
* implementation dependent.
|
2014-05-24 22:59:00 +02:00
|
|
|
*/
|
|
|
|
bool
|
2014-11-10 22:51:58 +01:00
|
|
|
_M_hint_used(_Base_const_iterator __hint, _Base_iterator __res)
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2014-05-25 10:38:01 +02:00
|
|
|
return (__hint == __res
|
2014-11-10 22:51:58 +01:00
|
|
|
|| (__hint == _M_base().end() && ++__res == _M_base().end())
|
|
|
|
|| (__hint != _M_base().end() && (++__hint == __res
|
|
|
|
|| ++__res == --__hint)));
|
2014-05-24 22:59:00 +02:00
|
|
|
}
|
2014-11-10 22:51:58 +01:00
|
|
|
|
|
|
|
template<typename _K1, typename _C1, typename _A1>
|
|
|
|
friend bool
|
|
|
|
operator==(const multiset<_K1, _C1, _A1>&,
|
|
|
|
const multiset<_K1, _C1, _A1>&);
|
|
|
|
|
|
|
|
template<typename _K1, typename _C1, typename _A1>
|
|
|
|
friend bool
|
|
|
|
operator< (const multiset<_K1, _C1, _A1>&,
|
|
|
|
const multiset<_K1, _C1, _A1>&);
|
2009-10-03 04:17:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
template<typename _Key, typename _Compare, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator==(const multiset<_Key, _Compare, _Allocator>& __lhs,
|
|
|
|
const multiset<_Key, _Compare, _Allocator>& __rhs)
|
2014-11-10 22:51:58 +01:00
|
|
|
{
|
|
|
|
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
|
|
|
|
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
|
|
|
|
return __lhs._M_base() == __rhs._M_base();
|
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
template<typename _Key, typename _Compare, typename _Allocator>
|
|
|
|
inline bool
|
2014-11-10 22:51:58 +01:00
|
|
|
operator<(const multiset<_Key, _Compare, _Allocator>& __lhs,
|
|
|
|
const multiset<_Key, _Compare, _Allocator>& __rhs)
|
|
|
|
{
|
|
|
|
__profcxx_map2umap_invalidate(__lhs._M_map2umap_info);
|
|
|
|
__profcxx_map2umap_invalidate(__rhs._M_map2umap_info);
|
|
|
|
return __lhs._M_base() < __rhs._M_base();
|
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
template<typename _Key, typename _Compare, typename _Allocator>
|
|
|
|
inline bool
|
2014-11-10 22:51:58 +01:00
|
|
|
operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs,
|
|
|
|
const multiset<_Key, _Compare, _Allocator>& __rhs)
|
|
|
|
{ return !(__lhs == __rhs); }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
template<typename _Key, typename _Compare, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs,
|
|
|
|
const multiset<_Key, _Compare, _Allocator>& __rhs)
|
2014-11-10 22:51:58 +01:00
|
|
|
{ return !(__rhs < __lhs); }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
template<typename _Key, typename _Compare, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs,
|
|
|
|
const multiset<_Key, _Compare, _Allocator>& __rhs)
|
2014-11-10 22:51:58 +01:00
|
|
|
{ return !(__lhs < __rhs); }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
template<typename _Key, typename _Compare, typename _Allocator>
|
|
|
|
inline bool
|
|
|
|
operator>(const multiset<_Key, _Compare, _Allocator>& __lhs,
|
|
|
|
const multiset<_Key, _Compare, _Allocator>& __rhs)
|
2014-11-10 22:51:58 +01:00
|
|
|
{ return __rhs < __lhs; }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
template<typename _Key, typename _Compare, typename _Allocator>
|
|
|
|
void
|
|
|
|
swap(multiset<_Key, _Compare, _Allocator>& __x,
|
|
|
|
multiset<_Key, _Compare, _Allocator>& __y)
|
c++config (_GLIBCXX_NOEXCEPT_IF): Define.
* include/bits/c++config (_GLIBCXX_NOEXCEPT_IF): Define.
* include/bits/forward_list.h (forward_list::swap): Make noexcept
unconditional.
* include/bits/hashtable.h (_Hashtable::swap): Do not use
_S_nothrow_swap().
* include/bits/stl_bvector.h (vector<bool>::swap): Make noexcept
unconditional.
* include/bits/stl_deque.h (deque::swap): Likewise.
(swap(deque&, deque&)): Use _GLIBCXX_NOEXCEPT_IF.
* include/bits/stl_list.h (list::swap): Make noexcept unconditional.
(swap(list&, list&)): Use _GLIBCXX_NOEXCEPT_IF.
* include/bits/stl_map.h (map::swap, swap(map&, map&)): Use
_GLIBCXX_NOEXCEPT_IF, do not depend on _S_nothrow_swap.
* include/bits/stl_multimap.h (multimap::swap,
swap(multimap&, multimap&)): Likewise.
* include/bits/stl_multiset.h (multiset::swap,
swap(multiset&, multiset&)): Likewise.
* include/bits/stl_set.h (set::swap, swap(set&, set&)): Likewise.
* include/bits/stl_tree.h (_Rb_tree::swap,
swap(_Rb_tree&, _Rb_tree&)): Likewise.
* include/bits/stl_vector.h (vector::swap): Make noexcept
unconditional.
(swap(vector&, vector&)): Use _GLIBCXX_NOEXCEPT_IF.
* include/debug/deque (deque::swap, swap): Likewise.
* include/debug/forward_list (swap): Add noexcept.
* include/debug/list (list::swap, swap): Use _GLIBCXX_NOEXCEPT_IF.
* include/debug/map.h (map::swap, swap): Likewise.
* include/debug/multimap.h (multimap::swap, swap): Likewise.
* include/debug/multiset.h (multiset::Swap, swap): Likewise.
* include/debug/set.h (set::swap, swap): Likewise.
* include/debug/unordered_map (unordered_map::swap,
unordered_multimap::swap, swap): Likewise.
* include/debug/unordered_set (unordered_set::swap,
unordered_multiset::swap, swap): Likewise.
* include/debug/vector (vector::swap, swap): Likewise.
* include/ext/alloc_traits.h (__alloc_traits::_S_nothrow_swap()):
Remove.
* include/profile/deque (deque::swap, swap): Use _GLIBCXX_NOEXCEPT_IF.
* include/profile/forward_list (swap): Add noexcept.
* include/profile/list (list::swap, swap) : Use _GLIBCXX_NOEXCEPT_IF.
* include/profile/map.h (map::swap, swap): Likewise.
* include/profile/multimap.h (multimap::swap, swap): Likewise.
* include/profile/multiset.h (multiset::swap, swap): Likewise.
* include/profile/set.h (set::swap, swap): Likewise.
* include/profile/unordered_map (swap): Likewise.
* include/profile/unordered_set (swap): Likewise.
* include/profile/vector (vector::swap, swap): Likewise. Remove
overloads for swapping rvalues.
* testsuite/23_containers/deque/allocator/noexcept.cc: Update tests
for noexcept on swap.
* testsuite/23_containers/forward_list/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/list/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/map/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/multimap/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/multiset/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/set/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/unordered_map/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/unordered_set/allocator/noexcept.cc:
Likewise.
* testsuite/23_containers/vector/allocator/noexcept.cc: Likewise.
* testsuite/23_containers/vector/bool/allocator/noexcept.cc: Likewise.
* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error line
number.
From-SVN: r225744
2015-07-13 19:15:48 +02:00
|
|
|
_GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
|
2009-10-03 04:17:41 +02:00
|
|
|
{ return __x.swap(__y); }
|
|
|
|
|
|
|
|
} // namespace __profile
|
|
|
|
} // namespace std
|
|
|
|
|
|
|
|
#endif
|