2009-10-03 04:17:41 +02:00
|
|
|
// Profiling unordered_map/unordered_multimap implementation -*- C++ -*-
|
|
|
|
|
2017-01-01 13:07:43 +01:00
|
|
|
// Copyright (C) 2009-2017 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
|
2012-02-21 11:55:54 +01:00
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
2009-10-03 04:17:41 +02:00
|
|
|
// any later version.
|
2012-02-21 11:55:54 +01:00
|
|
|
//
|
2009-10-03 04:17:41 +02:00
|
|
|
// 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.
|
2012-02-21 22:30:26 +01:00
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
// You should have received a copy of the GNU General Public License along
|
2012-02-21 11:55:54 +01:00
|
|
|
// with this library; see the file COPYING3. If not see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
/** @file profile/unordered_map
|
|
|
|
* This file is a GNU profile extension to the Standard C++ Library.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GLIBCXX_PROFILE_UNORDERED_MAP
|
|
|
|
#define _GLIBCXX_PROFILE_UNORDERED_MAP 1
|
|
|
|
|
2012-11-10 18:27:22 +01:00
|
|
|
#if __cplusplus < 201103L
|
2010-02-10 20:14:33 +01:00
|
|
|
# include <bits/c++0x_warning.h>
|
2010-03-30 12:59:17 +02:00
|
|
|
#else
|
|
|
|
# include <unordered_map>
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2010-03-30 12:59:17 +02:00
|
|
|
#include <profile/base.h>
|
2013-05-07 22:26:15 +02:00
|
|
|
#include <profile/unordered_base.h>
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
#define _GLIBCXX_BASE unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
|
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
|
|
|
#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
|
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::unordered_map wrapper with performance instrumentation.
|
2009-10-03 04:17:41 +02:00
|
|
|
template<typename _Key, typename _Tp,
|
2013-04-25 11:42:46 +02:00
|
|
|
typename _Hash = std::hash<_Key>,
|
2009-10-03 04:17:41 +02:00
|
|
|
typename _Pred = std::equal_to<_Key>,
|
2013-04-25 11:42:46 +02:00
|
|
|
typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
|
2009-10-03 04:17:41 +02:00
|
|
|
class unordered_map
|
2013-05-07 22:26:15 +02:00
|
|
|
: public _GLIBCXX_STD_BASE,
|
|
|
|
public _Unordered_profile<unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>,
|
|
|
|
true>
|
2009-10-03 04:17:41 +02:00
|
|
|
{
|
|
|
|
typedef typename _GLIBCXX_STD_BASE _Base;
|
|
|
|
|
2013-05-07 22:26:15 +02:00
|
|
|
_Base&
|
2014-05-24 22:59:00 +02:00
|
|
|
_M_base() noexcept { return *this; }
|
2013-05-07 22:26:15 +02:00
|
|
|
|
|
|
|
const _Base&
|
2014-05-24 22:59:00 +02:00
|
|
|
_M_base() const noexcept { return *this; }
|
2013-05-07 22:26:15 +02:00
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
public:
|
2014-05-24 22:59:00 +02:00
|
|
|
typedef typename _Base::size_type size_type;
|
|
|
|
typedef typename _Base::hasher hasher;
|
|
|
|
typedef typename _Base::key_equal key_equal;
|
|
|
|
typedef typename _Base::allocator_type allocator_type;
|
|
|
|
typedef typename _Base::key_type key_type;
|
|
|
|
typedef typename _Base::value_type value_type;
|
|
|
|
typedef typename _Base::difference_type difference_type;
|
|
|
|
typedef typename _Base::reference reference;
|
|
|
|
typedef typename _Base::const_reference const_reference;
|
|
|
|
typedef typename _Base::mapped_type mapped_type;
|
|
|
|
|
|
|
|
typedef typename _Base::iterator iterator;
|
|
|
|
typedef typename _Base::const_iterator const_iterator;
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2014-11-10 22:51:58 +01:00
|
|
|
unordered_map() = default;
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
explicit
|
2014-11-10 22:51:58 +01:00
|
|
|
unordered_map(size_type __n,
|
2009-10-03 04:17:41 +02:00
|
|
|
const hasher& __hf = hasher(),
|
|
|
|
const key_equal& __eql = key_equal(),
|
|
|
|
const allocator_type& __a = allocator_type())
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(__n, __hf, __eql, __a) { }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
template<typename _InputIterator>
|
2014-05-24 22:59:00 +02:00
|
|
|
unordered_map(_InputIterator __f, _InputIterator __l,
|
hashtable.h (_Hashtable<>::operator=(const _Hashtable&)): Move inline.
2010-08-13 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/hashtable.h (_Hashtable<>::operator=(const
_Hashtable&)): Move inline.
(operator=(_Hashtable&&)): Define.
* include/bits/unordered_map.h (unordered_map(unordered_map&&),
unordered_map(const unordered_map&), unordered_multimap
(unordered_multimap&&), unordered_multimap(const unordered_multimap&),
__unordered_map(__unordered_map&&), __unordered_map(const
__unordered_map&), __unordered_multimap(__unordered_multimap&&),
__unordered_multimap(const __unordered_multimap&)): Do not define,
leave implicit.
* include/bits/unordered_set.h (unordered_set(unordered_set&&),
unordered_set(const unordered_set&), unordered_multiset
(unordered_multiset&&), unordered_multiset(const unordered_multiset&),
__unordered_set(__unordered_set&&), __unordered_set(const
__unordered_set&), __unordered_multiset(__unordered_multiset&&),
__unordered_multiset(const __unordered_multiset&)): Likewise.
* include/bits/unordered_map.h (__unordered_map(initializer_list<>),
__unordered_map<>::operator=(initializer_list<>),
__unordered_multimap(initializer_list<>), __unordered_multimap<>::
operator=(initializer_list<>)): Add.
* include/bits/unordered_set.h (__unordered_set(initializer_list<>),
__unordered_set<>::operator=(initializer_list<>),
__unordered_multiset(initializer_list<>), __unordered_multiset<>::
operator=(initializer_list<>)): Likewise.
* include/bits/unordered_map.h (__unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Fix __n default to 0.
* include/bits/unordered_set.h (__unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
* include/debug/unordered_map (unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_map(_InputIterator, _InputIterator,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Likewise.
* include/debug/unordered_set (unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_set(_InputIterator, _InputIterator,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
* include/profile/unordered_map (unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_map(_InputIterator, _InputIterator,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Likewise.
* include/profile/unordered_set (unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_set(_InputIterator, _InputIterator,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
From-SVN: r163236
2010-08-14 03:00:23 +02:00
|
|
|
size_type __n = 0,
|
|
|
|
const hasher& __hf = hasher(),
|
|
|
|
const key_equal& __eql = key_equal(),
|
|
|
|
const allocator_type& __a = allocator_type())
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(__f, __l, __n, __hf, __eql, __a) { }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2013-05-07 22:26:15 +02:00
|
|
|
unordered_map(const unordered_map&) = default;
|
2011-11-09 09:23:30 +01:00
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
unordered_map(const _Base& __x)
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(__x) { }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2013-05-07 22:26:15 +02:00
|
|
|
unordered_map(unordered_map&&) = default;
|
|
|
|
|
|
|
|
explicit
|
|
|
|
unordered_map(const allocator_type& __a)
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(__a) { }
|
2013-05-07 22:26:15 +02:00
|
|
|
|
|
|
|
unordered_map(const unordered_map& __umap,
|
|
|
|
const allocator_type& __a)
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(__umap, __a) { }
|
2013-05-07 22:26:15 +02:00
|
|
|
|
|
|
|
unordered_map(unordered_map&& __umap,
|
|
|
|
const allocator_type& __a)
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(std::move(__umap._M_base()), __a) { }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
unordered_map(initializer_list<value_type> __l,
|
hashtable.h (_Hashtable<>::operator=(const _Hashtable&)): Move inline.
2010-08-13 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/hashtable.h (_Hashtable<>::operator=(const
_Hashtable&)): Move inline.
(operator=(_Hashtable&&)): Define.
* include/bits/unordered_map.h (unordered_map(unordered_map&&),
unordered_map(const unordered_map&), unordered_multimap
(unordered_multimap&&), unordered_multimap(const unordered_multimap&),
__unordered_map(__unordered_map&&), __unordered_map(const
__unordered_map&), __unordered_multimap(__unordered_multimap&&),
__unordered_multimap(const __unordered_multimap&)): Do not define,
leave implicit.
* include/bits/unordered_set.h (unordered_set(unordered_set&&),
unordered_set(const unordered_set&), unordered_multiset
(unordered_multiset&&), unordered_multiset(const unordered_multiset&),
__unordered_set(__unordered_set&&), __unordered_set(const
__unordered_set&), __unordered_multiset(__unordered_multiset&&),
__unordered_multiset(const __unordered_multiset&)): Likewise.
* include/bits/unordered_map.h (__unordered_map(initializer_list<>),
__unordered_map<>::operator=(initializer_list<>),
__unordered_multimap(initializer_list<>), __unordered_multimap<>::
operator=(initializer_list<>)): Add.
* include/bits/unordered_set.h (__unordered_set(initializer_list<>),
__unordered_set<>::operator=(initializer_list<>),
__unordered_multiset(initializer_list<>), __unordered_multiset<>::
operator=(initializer_list<>)): Likewise.
* include/bits/unordered_map.h (__unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Fix __n default to 0.
* include/bits/unordered_set.h (__unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
* include/debug/unordered_map (unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_map(_InputIterator, _InputIterator,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Likewise.
* include/debug/unordered_set (unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_set(_InputIterator, _InputIterator,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
* include/profile/unordered_map (unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_map(_InputIterator, _InputIterator,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Likewise.
* include/profile/unordered_set (unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_set(_InputIterator, _InputIterator,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
From-SVN: r163236
2010-08-14 03:00:23 +02:00
|
|
|
size_type __n = 0,
|
2009-10-03 04:17:41 +02:00
|
|
|
const hasher& __hf = hasher(),
|
|
|
|
const key_equal& __eql = key_equal(),
|
|
|
|
const allocator_type& __a = allocator_type())
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(__l, __n, __hf, __eql, __a) { }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2015-05-17 22:14:53 +02:00
|
|
|
unordered_map(size_type __n, const allocator_type& __a)
|
|
|
|
: unordered_map(__n, hasher(), key_equal(), __a)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
unordered_map(size_type __n, const hasher& __hf,
|
|
|
|
const allocator_type& __a)
|
|
|
|
: unordered_map(__n, __hf, key_equal(), __a)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
template<typename _InputIterator>
|
|
|
|
unordered_map(_InputIterator __first, _InputIterator __last,
|
|
|
|
size_type __n,
|
|
|
|
const allocator_type& __a)
|
|
|
|
: unordered_map(__first, __last, __n, hasher(), key_equal(), __a)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
template<typename _InputIterator>
|
|
|
|
unordered_map(_InputIterator __first, _InputIterator __last,
|
|
|
|
size_type __n, const hasher& __hf,
|
|
|
|
const allocator_type& __a)
|
|
|
|
: unordered_map(__first, __last, __n, __hf, key_equal(), __a)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
unordered_map(initializer_list<value_type> __l,
|
|
|
|
size_type __n,
|
|
|
|
const allocator_type& __a)
|
|
|
|
: unordered_map(__l, __n, hasher(), key_equal(), __a)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
unordered_map(initializer_list<value_type> __l,
|
|
|
|
size_type __n, const hasher& __hf,
|
|
|
|
const allocator_type& __a)
|
|
|
|
: unordered_map(__l, __n, __hf, key_equal(), __a)
|
|
|
|
{ }
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
unordered_map&
|
2013-05-07 22:26:15 +02:00
|
|
|
operator=(const unordered_map&) = default;
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
unordered_map&
|
2013-05-07 22:26:15 +02:00
|
|
|
operator=(unordered_map&&) = default;
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
unordered_map&
|
|
|
|
operator=(initializer_list<value_type> __l)
|
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_destruct();
|
2013-05-07 22:26:15 +02: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;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-05-26 17:35:02 +02:00
|
|
|
clear() noexcept
|
2009-10-03 04:17:41 +02:00
|
|
|
{
|
2014-05-24 22:59:00 +02:00
|
|
|
this->_M_profile_destruct();
|
2013-05-07 22:26:15 +02:00
|
|
|
_Base::clear();
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_construct();
|
2009-10-03 04:17:41 +02:00
|
|
|
}
|
|
|
|
|
2011-12-10 15:00:03 +01:00
|
|
|
template<typename... _Args>
|
|
|
|
std::pair<iterator, bool>
|
|
|
|
emplace(_Args&&... __args)
|
|
|
|
{
|
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
std::pair<iterator, bool> __res
|
|
|
|
= _Base::emplace(std::forward<_Args>(__args)...);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2011-12-10 15:00:03 +01:00
|
|
|
return __res;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename... _Args>
|
|
|
|
iterator
|
|
|
|
emplace_hint(const_iterator __it, _Args&&... __args)
|
|
|
|
{
|
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
iterator __res
|
|
|
|
= _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2011-12-10 15:00:03 +01:00
|
|
|
return __res;
|
|
|
|
}
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
void
|
|
|
|
insert(std::initializer_list<value_type> __l)
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
_Base::insert(__l);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2009-10-03 04:17:41 +02:00
|
|
|
}
|
|
|
|
|
2010-01-03 15:50:09 +01:00
|
|
|
std::pair<iterator, bool>
|
2009-10-03 04:17:41 +02:00
|
|
|
insert(const value_type& __obj)
|
|
|
|
{
|
2014-05-24 22:59:00 +02:00
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
std::pair<iterator, bool> __res = _Base::insert(__obj);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2014-05-24 22:59:00 +02:00
|
|
|
return __res;
|
2009-10-03 04:17:41 +02:00
|
|
|
}
|
2010-01-03 15:50:09 +01:00
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
iterator
|
|
|
|
insert(const_iterator __iter, const value_type& __v)
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
iterator __res = _Base::insert(__iter, __v);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2014-05-24 22:59:00 +02:00
|
|
|
return __res;
|
2009-10-03 04:17:41 +02:00
|
|
|
}
|
|
|
|
|
2010-10-28 18:01:05 +02:00
|
|
|
template<typename _Pair, typename = typename
|
2012-07-13 10:59:58 +02:00
|
|
|
std::enable_if<std::is_constructible<value_type,
|
|
|
|
_Pair&&>::value>::type>
|
2014-05-24 22:59:00 +02:00
|
|
|
std::pair<iterator, bool>
|
|
|
|
insert(_Pair&& __obj)
|
|
|
|
{
|
2011-12-10 15:00:03 +01:00
|
|
|
size_type __old_size = _Base::bucket_count();
|
2010-10-28 18:01:05 +02:00
|
|
|
std::pair<iterator, bool> __res
|
|
|
|
= _Base::insert(std::forward<_Pair>(__obj));
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2010-10-28 18:01:05 +02:00
|
|
|
return __res;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Pair, typename = typename
|
2012-07-13 10:59:58 +02:00
|
|
|
std::enable_if<std::is_constructible<value_type,
|
|
|
|
_Pair&&>::value>::type>
|
2014-05-24 22:59:00 +02:00
|
|
|
iterator
|
|
|
|
insert(const_iterator __iter, _Pair&& __v)
|
|
|
|
{
|
|
|
|
size_type __old_size = _Base::bucket_count();
|
2010-10-28 18:01:05 +02:00
|
|
|
iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2010-10-28 18:01:05 +02:00
|
|
|
return __res;
|
|
|
|
}
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
template<typename _InputIter>
|
2014-05-24 22:59:00 +02:00
|
|
|
void
|
|
|
|
insert(_InputIter __first, _InputIter __last)
|
|
|
|
{
|
|
|
|
size_type __old_size = _Base::bucket_count();
|
2010-05-05 21:53:11 +02:00
|
|
|
_Base::insert(__first, __last);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2010-02-10 17:09:42 +01:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2010-11-07 19:56:56 +01:00
|
|
|
// operator[]
|
|
|
|
mapped_type&
|
|
|
|
operator[](const _Key& __k)
|
|
|
|
{
|
2014-05-24 22:59:00 +02:00
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
mapped_type& __res = _M_base()[__k];
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2014-05-24 22:59:00 +02:00
|
|
|
return __res;
|
2010-11-07 19:56:56 +01:00
|
|
|
}
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
mapped_type&
|
2010-11-07 19:56:56 +01:00
|
|
|
operator[](_Key&& __k)
|
2009-10-03 04:17:41 +02:00
|
|
|
{
|
2014-05-24 22:59:00 +02:00
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
mapped_type& __res = _M_base()[std::move(__k)];
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2014-05-24 22:59:00 +02:00
|
|
|
return __res;
|
2010-11-07 19:56:56 +01:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
swap(unordered_map& __x)
|
2013-05-07 22:26:15 +02:00
|
|
|
noexcept( noexcept(__x._M_base().swap(__x)) )
|
2014-11-10 22:51:58 +01:00
|
|
|
{
|
|
|
|
_Base::swap(__x._M_base());
|
|
|
|
this->_M_swap(__x);
|
|
|
|
}
|
2010-02-10 17:09:42 +01:00
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
void rehash(size_type __n)
|
|
|
|
{
|
2011-12-10 15:00:03 +01:00
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
_Base::rehash(__n);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2009-10-03 04:17:41 +02:00
|
|
|
}
|
2011-12-10 15:00:03 +01:00
|
|
|
};
|
2010-02-10 17:09:42 +01:00
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
template<typename _Key, typename _Tp, typename _Hash,
|
2010-02-10 17:09:42 +01:00
|
|
|
typename _Pred, typename _Alloc>
|
2009-10-03 04:17:41 +02:00
|
|
|
inline void
|
|
|
|
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
2010-02-10 17:09:42 +01:00
|
|
|
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __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
|
|
|
noexcept(noexcept(__x.swap(__y)))
|
2009-10-03 04:17:41 +02:00
|
|
|
{ __x.swap(__y); }
|
|
|
|
|
2010-03-26 03:19:10 +01:00
|
|
|
template<typename _Key, typename _Tp, typename _Hash,
|
|
|
|
typename _Pred, typename _Alloc>
|
|
|
|
inline bool
|
|
|
|
operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
|
|
|
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
2012-10-27 14:20:18 +02:00
|
|
|
{ return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; }
|
2010-03-26 03:19:10 +01:00
|
|
|
|
|
|
|
template<typename _Key, typename _Tp, typename _Hash,
|
|
|
|
typename _Pred, typename _Alloc>
|
|
|
|
inline bool
|
|
|
|
operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
|
|
|
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
|
|
|
{ return !(__x == __y); }
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
#undef _GLIBCXX_BASE
|
|
|
|
#undef _GLIBCXX_STD_BASE
|
|
|
|
#define _GLIBCXX_BASE unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
|
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
|
|
|
#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2009-11-17 21:45:32 +01:00
|
|
|
/// Class std::unordered_multimap wrapper with performance instrumentation.
|
2009-10-03 04:17:41 +02:00
|
|
|
template<typename _Key, typename _Tp,
|
2013-04-25 11:42:46 +02:00
|
|
|
typename _Hash = std::hash<_Key>,
|
2009-10-03 04:17:41 +02:00
|
|
|
typename _Pred = std::equal_to<_Key>,
|
2013-04-25 11:42:46 +02:00
|
|
|
typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
|
2009-10-03 04:17:41 +02:00
|
|
|
class unordered_multimap
|
2013-05-07 22:26:15 +02:00
|
|
|
: public _GLIBCXX_STD_BASE,
|
|
|
|
public _Unordered_profile<unordered_multimap<_Key, _Tp,
|
|
|
|
_Hash, _Pred, _Alloc>,
|
|
|
|
false>
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
2009-10-03 04:17:41 +02:00
|
|
|
typedef typename _GLIBCXX_STD_BASE _Base;
|
|
|
|
|
2013-05-07 22:26:15 +02:00
|
|
|
_Base&
|
2014-05-24 22:59:00 +02:00
|
|
|
_M_base() noexcept { return *this; }
|
2013-05-07 22:26:15 +02:00
|
|
|
|
|
|
|
const _Base&
|
2014-05-24 22:59:00 +02:00
|
|
|
_M_base() const noexcept { return *this; }
|
2013-05-07 22:26:15 +02:00
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
public:
|
2014-05-24 22:59:00 +02:00
|
|
|
typedef typename _Base::size_type size_type;
|
|
|
|
typedef typename _Base::hasher hasher;
|
|
|
|
typedef typename _Base::key_equal key_equal;
|
|
|
|
typedef typename _Base::allocator_type allocator_type;
|
|
|
|
typedef typename _Base::key_type key_type;
|
|
|
|
typedef typename _Base::value_type value_type;
|
|
|
|
typedef typename _Base::difference_type difference_type;
|
|
|
|
typedef typename _Base::reference reference;
|
|
|
|
typedef typename _Base::const_reference const_reference;
|
|
|
|
|
|
|
|
typedef typename _Base::iterator iterator;
|
|
|
|
typedef typename _Base::const_iterator const_iterator;
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2014-11-10 22:51:58 +01:00
|
|
|
unordered_multimap() = default;
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
explicit
|
2014-11-10 22:51:58 +01:00
|
|
|
unordered_multimap(size_type __n,
|
hashtable.h (_Hashtable<>::operator=(const _Hashtable&)): Move inline.
2010-08-13 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/hashtable.h (_Hashtable<>::operator=(const
_Hashtable&)): Move inline.
(operator=(_Hashtable&&)): Define.
* include/bits/unordered_map.h (unordered_map(unordered_map&&),
unordered_map(const unordered_map&), unordered_multimap
(unordered_multimap&&), unordered_multimap(const unordered_multimap&),
__unordered_map(__unordered_map&&), __unordered_map(const
__unordered_map&), __unordered_multimap(__unordered_multimap&&),
__unordered_multimap(const __unordered_multimap&)): Do not define,
leave implicit.
* include/bits/unordered_set.h (unordered_set(unordered_set&&),
unordered_set(const unordered_set&), unordered_multiset
(unordered_multiset&&), unordered_multiset(const unordered_multiset&),
__unordered_set(__unordered_set&&), __unordered_set(const
__unordered_set&), __unordered_multiset(__unordered_multiset&&),
__unordered_multiset(const __unordered_multiset&)): Likewise.
* include/bits/unordered_map.h (__unordered_map(initializer_list<>),
__unordered_map<>::operator=(initializer_list<>),
__unordered_multimap(initializer_list<>), __unordered_multimap<>::
operator=(initializer_list<>)): Add.
* include/bits/unordered_set.h (__unordered_set(initializer_list<>),
__unordered_set<>::operator=(initializer_list<>),
__unordered_multiset(initializer_list<>), __unordered_multiset<>::
operator=(initializer_list<>)): Likewise.
* include/bits/unordered_map.h (__unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Fix __n default to 0.
* include/bits/unordered_set.h (__unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
* include/debug/unordered_map (unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_map(_InputIterator, _InputIterator,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Likewise.
* include/debug/unordered_set (unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_set(_InputIterator, _InputIterator,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
* include/profile/unordered_map (unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_map(_InputIterator, _InputIterator,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Likewise.
* include/profile/unordered_set (unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_set(_InputIterator, _InputIterator,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
From-SVN: r163236
2010-08-14 03:00:23 +02:00
|
|
|
const hasher& __hf = hasher(),
|
|
|
|
const key_equal& __eql = key_equal(),
|
|
|
|
const allocator_type& __a = allocator_type())
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(__n, __hf, __eql, __a) { }
|
2013-05-07 22:26:15 +02:00
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
template<typename _InputIterator>
|
2014-05-24 22:59:00 +02:00
|
|
|
unordered_multimap(_InputIterator __f, _InputIterator __l,
|
hashtable.h (_Hashtable<>::operator=(const _Hashtable&)): Move inline.
2010-08-13 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/hashtable.h (_Hashtable<>::operator=(const
_Hashtable&)): Move inline.
(operator=(_Hashtable&&)): Define.
* include/bits/unordered_map.h (unordered_map(unordered_map&&),
unordered_map(const unordered_map&), unordered_multimap
(unordered_multimap&&), unordered_multimap(const unordered_multimap&),
__unordered_map(__unordered_map&&), __unordered_map(const
__unordered_map&), __unordered_multimap(__unordered_multimap&&),
__unordered_multimap(const __unordered_multimap&)): Do not define,
leave implicit.
* include/bits/unordered_set.h (unordered_set(unordered_set&&),
unordered_set(const unordered_set&), unordered_multiset
(unordered_multiset&&), unordered_multiset(const unordered_multiset&),
__unordered_set(__unordered_set&&), __unordered_set(const
__unordered_set&), __unordered_multiset(__unordered_multiset&&),
__unordered_multiset(const __unordered_multiset&)): Likewise.
* include/bits/unordered_map.h (__unordered_map(initializer_list<>),
__unordered_map<>::operator=(initializer_list<>),
__unordered_multimap(initializer_list<>), __unordered_multimap<>::
operator=(initializer_list<>)): Add.
* include/bits/unordered_set.h (__unordered_set(initializer_list<>),
__unordered_set<>::operator=(initializer_list<>),
__unordered_multiset(initializer_list<>), __unordered_multiset<>::
operator=(initializer_list<>)): Likewise.
* include/bits/unordered_map.h (__unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Fix __n default to 0.
* include/bits/unordered_set.h (__unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
* include/debug/unordered_map (unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_map(_InputIterator, _InputIterator,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Likewise.
* include/debug/unordered_set (unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_set(_InputIterator, _InputIterator,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
* include/profile/unordered_map (unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_map(_InputIterator, _InputIterator,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Likewise.
* include/profile/unordered_set (unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_set(_InputIterator, _InputIterator,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
From-SVN: r163236
2010-08-14 03:00:23 +02:00
|
|
|
size_type __n = 0,
|
|
|
|
const hasher& __hf = hasher(),
|
|
|
|
const key_equal& __eql = key_equal(),
|
|
|
|
const allocator_type& __a = allocator_type())
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(__f, __l, __n, __hf, __eql, __a) { }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2013-05-07 22:26:15 +02:00
|
|
|
unordered_multimap(const unordered_multimap&) = default;
|
2011-11-09 09:23:30 +01:00
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
unordered_multimap(const _Base& __x)
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(__x) { }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2013-05-07 22:26:15 +02:00
|
|
|
unordered_multimap(unordered_multimap&&) = default;
|
|
|
|
|
|
|
|
explicit
|
|
|
|
unordered_multimap(const allocator_type& __a)
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(__a) { }
|
2013-05-07 22:26:15 +02:00
|
|
|
|
|
|
|
unordered_multimap(const unordered_multimap& __ummap,
|
|
|
|
const allocator_type& __a)
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(__ummap._M_base(), __a) { }
|
2013-05-07 22:26:15 +02:00
|
|
|
|
|
|
|
unordered_multimap(unordered_multimap&& __ummap,
|
|
|
|
const allocator_type& __a)
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(std::move(__ummap._M_base()), __a) { }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
unordered_multimap(initializer_list<value_type> __l,
|
hashtable.h (_Hashtable<>::operator=(const _Hashtable&)): Move inline.
2010-08-13 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/hashtable.h (_Hashtable<>::operator=(const
_Hashtable&)): Move inline.
(operator=(_Hashtable&&)): Define.
* include/bits/unordered_map.h (unordered_map(unordered_map&&),
unordered_map(const unordered_map&), unordered_multimap
(unordered_multimap&&), unordered_multimap(const unordered_multimap&),
__unordered_map(__unordered_map&&), __unordered_map(const
__unordered_map&), __unordered_multimap(__unordered_multimap&&),
__unordered_multimap(const __unordered_multimap&)): Do not define,
leave implicit.
* include/bits/unordered_set.h (unordered_set(unordered_set&&),
unordered_set(const unordered_set&), unordered_multiset
(unordered_multiset&&), unordered_multiset(const unordered_multiset&),
__unordered_set(__unordered_set&&), __unordered_set(const
__unordered_set&), __unordered_multiset(__unordered_multiset&&),
__unordered_multiset(const __unordered_multiset&)): Likewise.
* include/bits/unordered_map.h (__unordered_map(initializer_list<>),
__unordered_map<>::operator=(initializer_list<>),
__unordered_multimap(initializer_list<>), __unordered_multimap<>::
operator=(initializer_list<>)): Add.
* include/bits/unordered_set.h (__unordered_set(initializer_list<>),
__unordered_set<>::operator=(initializer_list<>),
__unordered_multiset(initializer_list<>), __unordered_multiset<>::
operator=(initializer_list<>)): Likewise.
* include/bits/unordered_map.h (__unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Fix __n default to 0.
* include/bits/unordered_set.h (__unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
* include/debug/unordered_map (unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_map(_InputIterator, _InputIterator,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Likewise.
* include/debug/unordered_set (unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_set(_InputIterator, _InputIterator,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
* include/profile/unordered_map (unordered_map(_InputIterator,
_InputIterator, size_type __n), unordered_map(initializer_list<>,
size_type __n), unordered_map(_InputIterator, _InputIterator,
size_type __n), unordered_multimap(initializer_list<>, size_type __n)):
Likewise.
* include/profile/unordered_set (unordered_set(_InputIterator,
_InputIterator, size_type __n), unordered_set(initializer_list<>,
size_type __n), unordered_set(_InputIterator, _InputIterator,
size_type __n), unordered_multiset(initializer_list<>, size_type __n)):
Likewise.
From-SVN: r163236
2010-08-14 03:00:23 +02:00
|
|
|
size_type __n = 0,
|
2009-10-03 04:17:41 +02:00
|
|
|
const hasher& __hf = hasher(),
|
|
|
|
const key_equal& __eql = key_equal(),
|
|
|
|
const allocator_type& __a = allocator_type())
|
2014-05-24 22:59:00 +02:00
|
|
|
: _Base(__l, __n, __hf, __eql, __a) { }
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2015-05-17 22:14:53 +02:00
|
|
|
unordered_multimap(size_type __n, const allocator_type& __a)
|
|
|
|
: unordered_multimap(__n, hasher(), key_equal(), __a)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
unordered_multimap(size_type __n, const hasher& __hf,
|
|
|
|
const allocator_type& __a)
|
|
|
|
: unordered_multimap(__n, __hf, key_equal(), __a)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
template<typename _InputIterator>
|
|
|
|
unordered_multimap(_InputIterator __first, _InputIterator __last,
|
|
|
|
size_type __n,
|
|
|
|
const allocator_type& __a)
|
|
|
|
: unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
template<typename _InputIterator>
|
|
|
|
unordered_multimap(_InputIterator __first, _InputIterator __last,
|
|
|
|
size_type __n, const hasher& __hf,
|
|
|
|
const allocator_type& __a)
|
|
|
|
: unordered_multimap(__first, __last, __n, __hf, key_equal(), __a)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
unordered_multimap(initializer_list<value_type> __l,
|
|
|
|
size_type __n,
|
|
|
|
const allocator_type& __a)
|
|
|
|
: unordered_multimap(__l, __n, hasher(), key_equal(), __a)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
unordered_multimap(initializer_list<value_type> __l,
|
|
|
|
size_type __n, const hasher& __hf,
|
|
|
|
const allocator_type& __a)
|
|
|
|
: unordered_multimap(__l, __n, __hf, key_equal(), __a)
|
|
|
|
{ }
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
unordered_multimap&
|
2013-05-07 22:26:15 +02:00
|
|
|
operator=(const unordered_multimap&) = default;
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
unordered_multimap&
|
2013-05-07 22:26:15 +02:00
|
|
|
operator=(unordered_multimap&&) = default;
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
unordered_multimap&
|
|
|
|
operator=(initializer_list<value_type> __l)
|
|
|
|
{
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_destruct();
|
2013-05-07 22:26:15 +02: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;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-05-26 17:35:02 +02:00
|
|
|
clear() noexcept
|
2009-10-03 04:17:41 +02:00
|
|
|
{
|
2013-05-07 22:26:15 +02:00
|
|
|
this->_M_profile_destruct();
|
|
|
|
_Base::clear();
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_construct();
|
2009-10-03 04:17:41 +02:00
|
|
|
}
|
|
|
|
|
2011-12-10 15:00:03 +01:00
|
|
|
template<typename... _Args>
|
|
|
|
iterator
|
|
|
|
emplace(_Args&&... __args)
|
|
|
|
{
|
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
iterator __res
|
|
|
|
= _Base::emplace(std::forward<_Args>(__args)...);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2011-12-10 15:00:03 +01:00
|
|
|
return __res;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename... _Args>
|
|
|
|
iterator
|
|
|
|
emplace_hint(const_iterator __it, _Args&&... __args)
|
|
|
|
{
|
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
iterator __res
|
|
|
|
= _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2011-12-10 15:00:03 +01:00
|
|
|
return __res;
|
|
|
|
}
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
void
|
|
|
|
insert(std::initializer_list<value_type> __l)
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
_Base::insert(__l);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2009-10-03 04:17:41 +02:00
|
|
|
}
|
|
|
|
|
2010-01-03 15:50:09 +01:00
|
|
|
iterator
|
2009-10-03 04:17:41 +02:00
|
|
|
insert(const value_type& __obj)
|
|
|
|
{
|
2014-05-24 22:59:00 +02:00
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
iterator __res = _Base::insert(__obj);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2014-05-24 22:59:00 +02:00
|
|
|
return __res;
|
2009-10-03 04:17:41 +02:00
|
|
|
}
|
2010-01-03 15:50:09 +01:00
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
iterator
|
|
|
|
insert(const_iterator __iter, const value_type& __v)
|
2014-05-24 22:59:00 +02:00
|
|
|
{
|
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
iterator __res = _Base::insert(__iter, __v);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2014-05-24 22:59:00 +02:00
|
|
|
return __res;
|
2009-10-03 04:17:41 +02:00
|
|
|
}
|
|
|
|
|
2010-10-28 18:01:05 +02:00
|
|
|
template<typename _Pair, typename = typename
|
2012-07-13 10:59:58 +02:00
|
|
|
std::enable_if<std::is_constructible<value_type,
|
|
|
|
_Pair&&>::value>::type>
|
2014-05-24 22:59:00 +02:00
|
|
|
iterator
|
|
|
|
insert(_Pair&& __obj)
|
|
|
|
{
|
2011-12-10 15:00:03 +01:00
|
|
|
size_type __old_size = _Base::bucket_count();
|
2010-10-28 18:01:05 +02:00
|
|
|
iterator __res = _Base::insert(std::forward<_Pair>(__obj));
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2010-10-28 18:01:05 +02:00
|
|
|
return __res;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Pair, typename = typename
|
2012-07-13 10:59:58 +02:00
|
|
|
std::enable_if<std::is_constructible<value_type,
|
|
|
|
_Pair&&>::value>::type>
|
2014-05-24 22:59:00 +02:00
|
|
|
iterator
|
|
|
|
insert(const_iterator __iter, _Pair&& __v)
|
|
|
|
{
|
|
|
|
size_type __old_size = _Base::bucket_count();
|
2010-10-28 18:01:05 +02:00
|
|
|
iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2010-10-28 18:01:05 +02:00
|
|
|
return __res;
|
|
|
|
}
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
template<typename _InputIter>
|
2014-05-24 22:59:00 +02:00
|
|
|
void
|
|
|
|
insert(_InputIter __first, _InputIter __last)
|
|
|
|
{
|
|
|
|
size_type __old_size = _Base::bucket_count();
|
2010-05-05 21:53:11 +02:00
|
|
|
_Base::insert(__first, __last);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2010-02-10 17:09:42 +01:00
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
swap(unordered_multimap& __x)
|
2013-05-07 22:26:15 +02:00
|
|
|
noexcept( noexcept(__x._M_base().swap(__x)) )
|
2014-11-10 22:51:58 +01:00
|
|
|
{
|
|
|
|
_Base::swap(__x._M_base());
|
|
|
|
this->_M_swap(__x);
|
|
|
|
}
|
2009-10-03 04:17:41 +02:00
|
|
|
|
2013-05-07 22:26:15 +02:00
|
|
|
void
|
|
|
|
rehash(size_type __n)
|
2009-10-03 04:17:41 +02:00
|
|
|
{
|
2014-05-24 22:59:00 +02:00
|
|
|
size_type __old_size = _Base::bucket_count();
|
|
|
|
_Base::rehash(__n);
|
2014-11-10 22:51:58 +01:00
|
|
|
this->_M_profile_resize(__old_size);
|
2009-10-03 04:17:41 +02:00
|
|
|
}
|
2011-12-10 15:00:03 +01:00
|
|
|
};
|
2010-02-10 17:09:42 +01:00
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
template<typename _Key, typename _Tp, typename _Hash,
|
2010-02-10 17:09:42 +01:00
|
|
|
typename _Pred, typename _Alloc>
|
2009-10-03 04:17:41 +02:00
|
|
|
inline void
|
|
|
|
swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
2010-02-10 17:09:42 +01:00
|
|
|
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __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
|
|
|
noexcept(noexcept(__x.swap(__y)))
|
2009-10-03 04:17:41 +02:00
|
|
|
{ __x.swap(__y); }
|
|
|
|
|
2010-03-26 03:19:10 +01:00
|
|
|
template<typename _Key, typename _Tp, typename _Hash,
|
|
|
|
typename _Pred, typename _Alloc>
|
|
|
|
inline bool
|
|
|
|
operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
|
|
|
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
2012-10-27 14:20:18 +02:00
|
|
|
{ return static_cast<const _GLIBCXX_STD_BASE&>(__x) == __y; }
|
2010-03-26 03:19:10 +01:00
|
|
|
|
|
|
|
template<typename _Key, typename _Tp, typename _Hash,
|
|
|
|
typename _Pred, typename _Alloc>
|
|
|
|
inline bool
|
|
|
|
operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
|
|
|
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
|
|
|
{ return !(__x == __y); }
|
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
} // namespace __profile
|
|
|
|
} // namespace std
|
|
|
|
|
|
|
|
#undef _GLIBCXX_BASE
|
|
|
|
#undef _GLIBCXX_STD_BASE
|
|
|
|
|
2012-11-10 18:27:22 +01:00
|
|
|
#endif // C++11
|
2010-03-30 12:59:17 +02:00
|
|
|
|
2009-10-03 04:17:41 +02:00
|
|
|
#endif
|