gcc/libstdc++-v3/include/bits/hashtable_policy.h

1989 lines
62 KiB
C
Raw Normal View History

hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
// Internal policy header for unordered_set and unordered_map -*- C++ -*-
2021-01-04 10:26:59 +01:00
// Copyright (C) 2010-2021 Free Software Foundation, Inc.
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00: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 bits/hashtable_policy.h
* This is an internal header file, included by other library headers.
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
* Do not attempt to use it directly.
* @headername{unordered_map,unordered_set}
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
*/
#ifndef _HASHTABLE_POLICY_H
#define _HASHTABLE_POLICY_H 1
#include <tuple> // for std::tuple, std::forward_as_tuple
#include <bits/stl_algobase.h> // for std::min, std::is_permutation.
#include <ext/numeric_traits.h> // for __gnu_cxx::__int_traits
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 22:39:36 +00:00
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
class _Hashtable;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
namespace __detail
{
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/**
* @defgroup hashtable-detail Base and Implementation Classes
* @ingroup unordered_associative_containers
* @{
*/
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
template<typename _Key, typename _Value, typename _ExtractKey,
typename _Equal, typename _Hash, typename _RangeHash,
typename _Unused, typename _Traits>
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
struct _Hashtable_base;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
// Helper function: return distance(first, last) for forward
// iterators, or 0/1 for input iterators.
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
template<class _Iterator>
inline typename std::iterator_traits<_Iterator>::difference_type
__distance_fw(_Iterator __first, _Iterator __last,
std::input_iterator_tag)
{ return __first != __last ? 1 : 0; }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
template<class _Iterator>
inline typename std::iterator_traits<_Iterator>::difference_type
__distance_fw(_Iterator __first, _Iterator __last,
std::forward_iterator_tag)
{ return std::distance(__first, __last); }
template<class _Iterator>
inline typename std::iterator_traits<_Iterator>::difference_type
__distance_fw(_Iterator __first, _Iterator __last)
{ return __distance_fw(__first, __last,
std::__iterator_category(__first)); }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
struct _Identity
{
template<typename _Tp>
_Tp&&
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
operator()(_Tp&& __x) const noexcept
{ return std::forward<_Tp>(__x); }
};
struct _Select1st
{
template<typename _Tp>
auto
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
operator()(_Tp&& __x) const noexcept
-> decltype(std::get<0>(std::forward<_Tp>(__x)))
{ return std::get<0>(std::forward<_Tp>(__x)); }
};
libstdc++: Limit allocation on iterator insertion in Hashtable [PR 96088] When inserting into unordered_multiset or unordered_multimap first instantiate the node to store and compute the hash code from it to avoid a potential intermediate key_type instantiation. When inserting into unordered_set or unordered_map check if invoking the hash functor with container key_type is noexcept and invoking the same hash functor with key part of the iterator value_type can throw. In this case create a temporary key_type instance at Hashtable level and use it to compute the hash code. This temporary instance is moved to the final storage location if needed. libstdc++-v3/ChangeLog: PR libstdc++/96088 * include/bits/hashtable_policy.h (_Select2nd): New. (_NodeBuilder<>): New. (_ReuseOrAllocNode<>::operator()): Use variadic template args. (_AllocNode<>::operator()): Likewise. * include/bits/hashtable.h (_Hashtable<>::__node_builder_t): New. (_Hashtable<>::_M_insert_unique<>(_Kt&&, _Arg&&, const _NodeGenerator&)): New. (_Hashtable<>::_S_forward_key): New. (_Hashtable<>::_M_insert): Use latter. (_Hashtable<>::_M_insert(const_iterator, _Arg&&, const _NodeGenerator&, false_type)): Instantiate node first, compute hash code second. * testsuite/23_containers/unordered_map/96088.cc: New test. * testsuite/23_containers/unordered_multimap/96088.cc: New test. * testsuite/23_containers/unordered_multiset/96088.cc: New test. * testsuite/23_containers/unordered_set/96088.cc: New test. * testsuite/util/replacement_memory_operators.h (counter::_M_increment): New. (counter::_M_decrement): New. (counter::reset()): New.
2020-08-25 21:31:23 +02:00
struct _Select2nd
{
template<typename _Tp>
auto
operator()(_Tp&& __x) const noexcept
-> decltype(std::get<1>(std::forward<_Tp>(__x)))
{ return std::get<1>(std::forward<_Tp>(__x)); }
};
template<typename _ExKey>
struct _NodeBuilder;
template<>
struct _NodeBuilder<_Select1st>
{
template<typename _Kt, typename _Arg, typename _NodeGenerator>
static auto
_S_build(_Kt&& __k, _Arg&& __arg, const _NodeGenerator& __node_gen)
-> decltype(__node_gen(std::piecewise_construct,
std::forward_as_tuple(std::forward<_Kt>(__k)),
std::forward_as_tuple(_Select2nd{}(
std::forward<_Arg>(__arg)))))
{
return __node_gen(std::piecewise_construct,
std::forward_as_tuple(std::forward<_Kt>(__k)),
std::forward_as_tuple(_Select2nd{}(std::forward<_Arg>(__arg))));
}
};
template<>
struct _NodeBuilder<_Identity>
{
template<typename _Kt, typename _Arg, typename _NodeGenerator>
static auto
_S_build(_Kt&& __k, _Arg&&, const _NodeGenerator& __node_gen)
-> decltype(__node_gen(std::forward<_Kt>(__k)))
{ return __node_gen(std::forward<_Kt>(__k)); }
};
template<typename _NodeAlloc>
struct _Hashtable_alloc;
// Functor recycling a pool of nodes and using allocation once the pool is
// empty.
template<typename _NodeAlloc>
struct _ReuseOrAllocNode
{
private:
using __node_alloc_type = _NodeAlloc;
using __hashtable_alloc = _Hashtable_alloc<__node_alloc_type>;
using __node_alloc_traits =
typename __hashtable_alloc::__node_alloc_traits;
using __node_type = typename __hashtable_alloc::__node_type;
public:
_ReuseOrAllocNode(__node_type* __nodes, __hashtable_alloc& __h)
: _M_nodes(__nodes), _M_h(__h) { }
_ReuseOrAllocNode(const _ReuseOrAllocNode&) = delete;
~_ReuseOrAllocNode()
{ _M_h._M_deallocate_nodes(_M_nodes); }
libstdc++: Limit allocation on iterator insertion in Hashtable [PR 96088] When inserting into unordered_multiset or unordered_multimap first instantiate the node to store and compute the hash code from it to avoid a potential intermediate key_type instantiation. When inserting into unordered_set or unordered_map check if invoking the hash functor with container key_type is noexcept and invoking the same hash functor with key part of the iterator value_type can throw. In this case create a temporary key_type instance at Hashtable level and use it to compute the hash code. This temporary instance is moved to the final storage location if needed. libstdc++-v3/ChangeLog: PR libstdc++/96088 * include/bits/hashtable_policy.h (_Select2nd): New. (_NodeBuilder<>): New. (_ReuseOrAllocNode<>::operator()): Use variadic template args. (_AllocNode<>::operator()): Likewise. * include/bits/hashtable.h (_Hashtable<>::__node_builder_t): New. (_Hashtable<>::_M_insert_unique<>(_Kt&&, _Arg&&, const _NodeGenerator&)): New. (_Hashtable<>::_S_forward_key): New. (_Hashtable<>::_M_insert): Use latter. (_Hashtable<>::_M_insert(const_iterator, _Arg&&, const _NodeGenerator&, false_type)): Instantiate node first, compute hash code second. * testsuite/23_containers/unordered_map/96088.cc: New test. * testsuite/23_containers/unordered_multimap/96088.cc: New test. * testsuite/23_containers/unordered_multiset/96088.cc: New test. * testsuite/23_containers/unordered_set/96088.cc: New test. * testsuite/util/replacement_memory_operators.h (counter::_M_increment): New. (counter::_M_decrement): New. (counter::reset()): New.
2020-08-25 21:31:23 +02:00
template<typename... _Args>
__node_type*
libstdc++: Limit allocation on iterator insertion in Hashtable [PR 96088] When inserting into unordered_multiset or unordered_multimap first instantiate the node to store and compute the hash code from it to avoid a potential intermediate key_type instantiation. When inserting into unordered_set or unordered_map check if invoking the hash functor with container key_type is noexcept and invoking the same hash functor with key part of the iterator value_type can throw. In this case create a temporary key_type instance at Hashtable level and use it to compute the hash code. This temporary instance is moved to the final storage location if needed. libstdc++-v3/ChangeLog: PR libstdc++/96088 * include/bits/hashtable_policy.h (_Select2nd): New. (_NodeBuilder<>): New. (_ReuseOrAllocNode<>::operator()): Use variadic template args. (_AllocNode<>::operator()): Likewise. * include/bits/hashtable.h (_Hashtable<>::__node_builder_t): New. (_Hashtable<>::_M_insert_unique<>(_Kt&&, _Arg&&, const _NodeGenerator&)): New. (_Hashtable<>::_S_forward_key): New. (_Hashtable<>::_M_insert): Use latter. (_Hashtable<>::_M_insert(const_iterator, _Arg&&, const _NodeGenerator&, false_type)): Instantiate node first, compute hash code second. * testsuite/23_containers/unordered_map/96088.cc: New test. * testsuite/23_containers/unordered_multimap/96088.cc: New test. * testsuite/23_containers/unordered_multiset/96088.cc: New test. * testsuite/23_containers/unordered_set/96088.cc: New test. * testsuite/util/replacement_memory_operators.h (counter::_M_increment): New. (counter::_M_decrement): New. (counter::reset()): New.
2020-08-25 21:31:23 +02:00
operator()(_Args&&... __args) const
{
if (_M_nodes)
{
__node_type* __node = _M_nodes;
_M_nodes = _M_nodes->_M_next();
__node->_M_nxt = nullptr;
auto& __a = _M_h._M_node_allocator();
__node_alloc_traits::destroy(__a, __node->_M_valptr());
__try
{
__node_alloc_traits::construct(__a, __node->_M_valptr(),
libstdc++: Limit allocation on iterator insertion in Hashtable [PR 96088] When inserting into unordered_multiset or unordered_multimap first instantiate the node to store and compute the hash code from it to avoid a potential intermediate key_type instantiation. When inserting into unordered_set or unordered_map check if invoking the hash functor with container key_type is noexcept and invoking the same hash functor with key part of the iterator value_type can throw. In this case create a temporary key_type instance at Hashtable level and use it to compute the hash code. This temporary instance is moved to the final storage location if needed. libstdc++-v3/ChangeLog: PR libstdc++/96088 * include/bits/hashtable_policy.h (_Select2nd): New. (_NodeBuilder<>): New. (_ReuseOrAllocNode<>::operator()): Use variadic template args. (_AllocNode<>::operator()): Likewise. * include/bits/hashtable.h (_Hashtable<>::__node_builder_t): New. (_Hashtable<>::_M_insert_unique<>(_Kt&&, _Arg&&, const _NodeGenerator&)): New. (_Hashtable<>::_S_forward_key): New. (_Hashtable<>::_M_insert): Use latter. (_Hashtable<>::_M_insert(const_iterator, _Arg&&, const _NodeGenerator&, false_type)): Instantiate node first, compute hash code second. * testsuite/23_containers/unordered_map/96088.cc: New test. * testsuite/23_containers/unordered_multimap/96088.cc: New test. * testsuite/23_containers/unordered_multiset/96088.cc: New test. * testsuite/23_containers/unordered_set/96088.cc: New test. * testsuite/util/replacement_memory_operators.h (counter::_M_increment): New. (counter::_M_decrement): New. (counter::reset()): New.
2020-08-25 21:31:23 +02:00
std::forward<_Args>(__args)...);
}
__catch(...)
{
_M_h._M_deallocate_node_ptr(__node);
__throw_exception_again;
}
return __node;
}
libstdc++: Limit allocation on iterator insertion in Hashtable [PR 96088] When inserting into unordered_multiset or unordered_multimap first instantiate the node to store and compute the hash code from it to avoid a potential intermediate key_type instantiation. When inserting into unordered_set or unordered_map check if invoking the hash functor with container key_type is noexcept and invoking the same hash functor with key part of the iterator value_type can throw. In this case create a temporary key_type instance at Hashtable level and use it to compute the hash code. This temporary instance is moved to the final storage location if needed. libstdc++-v3/ChangeLog: PR libstdc++/96088 * include/bits/hashtable_policy.h (_Select2nd): New. (_NodeBuilder<>): New. (_ReuseOrAllocNode<>::operator()): Use variadic template args. (_AllocNode<>::operator()): Likewise. * include/bits/hashtable.h (_Hashtable<>::__node_builder_t): New. (_Hashtable<>::_M_insert_unique<>(_Kt&&, _Arg&&, const _NodeGenerator&)): New. (_Hashtable<>::_S_forward_key): New. (_Hashtable<>::_M_insert): Use latter. (_Hashtable<>::_M_insert(const_iterator, _Arg&&, const _NodeGenerator&, false_type)): Instantiate node first, compute hash code second. * testsuite/23_containers/unordered_map/96088.cc: New test. * testsuite/23_containers/unordered_multimap/96088.cc: New test. * testsuite/23_containers/unordered_multiset/96088.cc: New test. * testsuite/23_containers/unordered_set/96088.cc: New test. * testsuite/util/replacement_memory_operators.h (counter::_M_increment): New. (counter::_M_decrement): New. (counter::reset()): New.
2020-08-25 21:31:23 +02:00
return _M_h._M_allocate_node(std::forward<_Args>(__args)...);
}
private:
mutable __node_type* _M_nodes;
__hashtable_alloc& _M_h;
};
// Functor similar to the previous one but without any pool of nodes to
// recycle.
template<typename _NodeAlloc>
struct _AllocNode
{
private:
using __hashtable_alloc = _Hashtable_alloc<_NodeAlloc>;
using __node_type = typename __hashtable_alloc::__node_type;
public:
_AllocNode(__hashtable_alloc& __h)
: _M_h(__h) { }
libstdc++: Limit allocation on iterator insertion in Hashtable [PR 96088] When inserting into unordered_multiset or unordered_multimap first instantiate the node to store and compute the hash code from it to avoid a potential intermediate key_type instantiation. When inserting into unordered_set or unordered_map check if invoking the hash functor with container key_type is noexcept and invoking the same hash functor with key part of the iterator value_type can throw. In this case create a temporary key_type instance at Hashtable level and use it to compute the hash code. This temporary instance is moved to the final storage location if needed. libstdc++-v3/ChangeLog: PR libstdc++/96088 * include/bits/hashtable_policy.h (_Select2nd): New. (_NodeBuilder<>): New. (_ReuseOrAllocNode<>::operator()): Use variadic template args. (_AllocNode<>::operator()): Likewise. * include/bits/hashtable.h (_Hashtable<>::__node_builder_t): New. (_Hashtable<>::_M_insert_unique<>(_Kt&&, _Arg&&, const _NodeGenerator&)): New. (_Hashtable<>::_S_forward_key): New. (_Hashtable<>::_M_insert): Use latter. (_Hashtable<>::_M_insert(const_iterator, _Arg&&, const _NodeGenerator&, false_type)): Instantiate node first, compute hash code second. * testsuite/23_containers/unordered_map/96088.cc: New test. * testsuite/23_containers/unordered_multimap/96088.cc: New test. * testsuite/23_containers/unordered_multiset/96088.cc: New test. * testsuite/23_containers/unordered_set/96088.cc: New test. * testsuite/util/replacement_memory_operators.h (counter::_M_increment): New. (counter::_M_decrement): New. (counter::reset()): New.
2020-08-25 21:31:23 +02:00
template<typename... _Args>
__node_type*
libstdc++: Limit allocation on iterator insertion in Hashtable [PR 96088] When inserting into unordered_multiset or unordered_multimap first instantiate the node to store and compute the hash code from it to avoid a potential intermediate key_type instantiation. When inserting into unordered_set or unordered_map check if invoking the hash functor with container key_type is noexcept and invoking the same hash functor with key part of the iterator value_type can throw. In this case create a temporary key_type instance at Hashtable level and use it to compute the hash code. This temporary instance is moved to the final storage location if needed. libstdc++-v3/ChangeLog: PR libstdc++/96088 * include/bits/hashtable_policy.h (_Select2nd): New. (_NodeBuilder<>): New. (_ReuseOrAllocNode<>::operator()): Use variadic template args. (_AllocNode<>::operator()): Likewise. * include/bits/hashtable.h (_Hashtable<>::__node_builder_t): New. (_Hashtable<>::_M_insert_unique<>(_Kt&&, _Arg&&, const _NodeGenerator&)): New. (_Hashtable<>::_S_forward_key): New. (_Hashtable<>::_M_insert): Use latter. (_Hashtable<>::_M_insert(const_iterator, _Arg&&, const _NodeGenerator&, false_type)): Instantiate node first, compute hash code second. * testsuite/23_containers/unordered_map/96088.cc: New test. * testsuite/23_containers/unordered_multimap/96088.cc: New test. * testsuite/23_containers/unordered_multiset/96088.cc: New test. * testsuite/23_containers/unordered_set/96088.cc: New test. * testsuite/util/replacement_memory_operators.h (counter::_M_increment): New. (counter::_M_decrement): New. (counter::reset()): New.
2020-08-25 21:31:23 +02:00
operator()(_Args&&... __args) const
{ return _M_h._M_allocate_node(std::forward<_Args>(__args)...); }
private:
__hashtable_alloc& _M_h;
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
// Auxiliary types used for all instantiations of _Hashtable nodes
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
// and iterators.
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/**
* struct _Hashtable_traits
*
* Important traits for hash tables.
*
* @tparam _Cache_hash_code Boolean value. True if the value of
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
* the hash function is stored along with the value. This is a
* time-space tradeoff. Storing it may improve lookup speed by
* reducing the number of times we need to call the _Hash or _Equal
* functors.
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
*
* @tparam _Constant_iterators Boolean value. True if iterator and
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
* const_iterator are both constant iterator types. This is true
* for unordered_set and unordered_multiset, false for
* unordered_map and unordered_multimap.
*
* @tparam _Unique_keys Boolean value. True if the return value
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
* of _Hashtable::count(k) is always at most one, false if it may
* be an arbitrary number. This is true for unordered_set and
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
* unordered_map, false for unordered_multiset and
* unordered_multimap.
*/
template<bool _Cache_hash_code, bool _Constant_iterators, bool _Unique_keys>
struct _Hashtable_traits
{
using __hash_cached = __bool_constant<_Cache_hash_code>;
using __constant_iterators = __bool_constant<_Constant_iterators>;
using __unique_keys = __bool_constant<_Unique_keys>;
};
/**
* struct _Hash_node_base
*
* Nodes, used to wrap elements stored in the hash table. A policy
* template parameter of class template _Hashtable controls whether
* nodes also store a hash code. In some cases (e.g. strings) this
* may be a performance win.
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
*/
struct _Hash_node_base
{
_Hash_node_base* _M_nxt;
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
_Hash_node_base() noexcept : _M_nxt() { }
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
_Hash_node_base(_Hash_node_base* __next) noexcept : _M_nxt(__next) { }
};
hashtable_policy.h: Add C++11 allocator support. 2013-04-22 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h: Add C++11 allocator support. * include/bits/hashtable.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/unordered_map: Likewise. * include/std/unordered_set: Remove bits/algobase.h include. Replace bits/alloc_traits.h by ext/alloc_traits.h. * include/std/unordered_map: Likewise. * include/ext/throw_allocator.h: Add checks on calls to allocator construct/destroy. (std::hash<__gnu_cxx::throw_value_limit>): Add conditional throw. (std::hash<__gnu_cxx::throw_value_random>): Likewise. * testsuite/util/regression/rand/priority_queue /container_rand_regression_test.tcc: Adapt. * testsuite/util/regression/rand/assoc /container_rand_regression_test.tcc: Likewise. * testsuite/util/testsuite_counter_type.h: Add count of destructors. * testsuite/23_containers/unordered_set /not_default_constructible_hash_neg.cc: Adjust dg-error line number. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: New. * testsuite/23_containers/unordered_set/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/minimal.cc: New. * testsuite/23_containers/unordered_set/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_set/allocator/swap.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multiset/allocator/swap.cc: New. * testsuite/23_containers/unordered_map/allocator/copy.cc: New. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/minimal.cc: New. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_map/allocator/swap.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multimap/allocator/swap.cc: New. From-SVN: r198158
2013-04-22 20:22:07 +00:00
/**
* struct _Hash_node_value_base
*
* Node type with the value to store.
*/
template<typename _Value>
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
struct _Hash_node_value_base
hashtable_policy.h: Add C++11 allocator support. 2013-04-22 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h: Add C++11 allocator support. * include/bits/hashtable.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/unordered_map: Likewise. * include/std/unordered_set: Remove bits/algobase.h include. Replace bits/alloc_traits.h by ext/alloc_traits.h. * include/std/unordered_map: Likewise. * include/ext/throw_allocator.h: Add checks on calls to allocator construct/destroy. (std::hash<__gnu_cxx::throw_value_limit>): Add conditional throw. (std::hash<__gnu_cxx::throw_value_random>): Likewise. * testsuite/util/regression/rand/priority_queue /container_rand_regression_test.tcc: Adapt. * testsuite/util/regression/rand/assoc /container_rand_regression_test.tcc: Likewise. * testsuite/util/testsuite_counter_type.h: Add count of destructors. * testsuite/23_containers/unordered_set /not_default_constructible_hash_neg.cc: Adjust dg-error line number. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: New. * testsuite/23_containers/unordered_set/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/minimal.cc: New. * testsuite/23_containers/unordered_set/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_set/allocator/swap.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multiset/allocator/swap.cc: New. * testsuite/23_containers/unordered_map/allocator/copy.cc: New. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/minimal.cc: New. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_map/allocator/swap.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multimap/allocator/swap.cc: New. From-SVN: r198158
2013-04-22 20:22:07 +00:00
{
typedef _Value value_type;
hashtable_policy.h: Add C++11 allocator support. 2013-04-22 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h: Add C++11 allocator support. * include/bits/hashtable.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/unordered_map: Likewise. * include/std/unordered_set: Remove bits/algobase.h include. Replace bits/alloc_traits.h by ext/alloc_traits.h. * include/std/unordered_map: Likewise. * include/ext/throw_allocator.h: Add checks on calls to allocator construct/destroy. (std::hash<__gnu_cxx::throw_value_limit>): Add conditional throw. (std::hash<__gnu_cxx::throw_value_random>): Likewise. * testsuite/util/regression/rand/priority_queue /container_rand_regression_test.tcc: Adapt. * testsuite/util/regression/rand/assoc /container_rand_regression_test.tcc: Likewise. * testsuite/util/testsuite_counter_type.h: Add count of destructors. * testsuite/23_containers/unordered_set /not_default_constructible_hash_neg.cc: Adjust dg-error line number. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: New. * testsuite/23_containers/unordered_set/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/minimal.cc: New. * testsuite/23_containers/unordered_set/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_set/allocator/swap.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multiset/allocator/swap.cc: New. * testsuite/23_containers/unordered_map/allocator/copy.cc: New. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/minimal.cc: New. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_map/allocator/swap.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multimap/allocator/swap.cc: New. From-SVN: r198158
2013-04-22 20:22:07 +00:00
__gnu_cxx::__aligned_buffer<_Value> _M_storage;
_Value*
_M_valptr() noexcept
{ return _M_storage._M_ptr(); }
const _Value*
_M_valptr() const noexcept
{ return _M_storage._M_ptr(); }
_Value&
_M_v() noexcept
{ return *_M_valptr(); }
const _Value&
_M_v() const noexcept
{ return *_M_valptr(); }
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/**
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
* Primary template struct _Hash_node_code_cache.
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
*/
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
template<bool _Cache_hash_code>
struct _Hash_node_code_cache
{ };
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
/**
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
* Specialization for node with cache, struct _Hash_node_code_cache.
*/
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
template<>
struct _Hash_node_code_cache<true>
{ std::size_t _M_hash_code; };
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
template<typename _Value, bool _Cache_hash_code>
struct _Hash_node_value
: _Hash_node_value_base<_Value>
, _Hash_node_code_cache<_Cache_hash_code>
{ };
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
/**
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
* Primary template struct _Hash_node.
*/
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
template<typename _Value, bool _Cache_hash_code>
struct _Hash_node
: _Hash_node_base
, _Hash_node_value<_Value, _Cache_hash_code>
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
{
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
_Hash_node*
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
_M_next() const noexcept
{ return static_cast<_Hash_node*>(this->_M_nxt); }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/// Base class for node iterators.
template<typename _Value, bool _Cache_hash_code>
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
struct _Node_iterator_base
{
using __node_type = _Hash_node<_Value, _Cache_hash_code>;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
__node_type* _M_cur;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
_Node_iterator_base() : _M_cur(nullptr) { }
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
_Node_iterator_base(__node_type* __p) noexcept
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
: _M_cur(__p) { }
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
void
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
_M_incr() noexcept
{ _M_cur = _M_cur->_M_next(); }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
friend bool
operator==(const _Node_iterator_base& __x, const _Node_iterator_base& __y)
noexcept
{ return __x._M_cur == __y._M_cur; }
#if __cpp_impl_three_way_comparison < 201907L
friend bool
operator!=(const _Node_iterator_base& __x, const _Node_iterator_base& __y)
noexcept
{ return __x._M_cur != __y._M_cur; }
#endif
};
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/// Node iterators, used to iterate through all the hashtable.
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
template<typename _Value, bool __constant_iterators, bool __cache>
struct _Node_iterator
: public _Node_iterator_base<_Value, __cache>
{
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
private:
using __base_type = _Node_iterator_base<_Value, __cache>;
using __node_type = typename __base_type::__node_type;
public:
typedef _Value value_type;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
using pointer = typename std::conditional<__constant_iterators,
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
const value_type*, value_type*>::type;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
using reference = typename std::conditional<__constant_iterators,
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
const value_type&, value_type&>::type;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
_Node_iterator() = default;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
explicit
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
_Node_iterator(__node_type* __p) noexcept
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
: __base_type(__p) { }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
reference
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
operator*() const noexcept
hashtable_policy.h: Add C++11 allocator support. 2013-04-22 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h: Add C++11 allocator support. * include/bits/hashtable.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/unordered_map: Likewise. * include/std/unordered_set: Remove bits/algobase.h include. Replace bits/alloc_traits.h by ext/alloc_traits.h. * include/std/unordered_map: Likewise. * include/ext/throw_allocator.h: Add checks on calls to allocator construct/destroy. (std::hash<__gnu_cxx::throw_value_limit>): Add conditional throw. (std::hash<__gnu_cxx::throw_value_random>): Likewise. * testsuite/util/regression/rand/priority_queue /container_rand_regression_test.tcc: Adapt. * testsuite/util/regression/rand/assoc /container_rand_regression_test.tcc: Likewise. * testsuite/util/testsuite_counter_type.h: Add count of destructors. * testsuite/23_containers/unordered_set /not_default_constructible_hash_neg.cc: Adjust dg-error line number. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: New. * testsuite/23_containers/unordered_set/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/minimal.cc: New. * testsuite/23_containers/unordered_set/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_set/allocator/swap.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multiset/allocator/swap.cc: New. * testsuite/23_containers/unordered_map/allocator/copy.cc: New. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/minimal.cc: New. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_map/allocator/swap.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multimap/allocator/swap.cc: New. From-SVN: r198158
2013-04-22 20:22:07 +00:00
{ return this->_M_cur->_M_v(); }
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
pointer
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
operator->() const noexcept
hashtable_policy.h: Add C++11 allocator support. 2013-04-22 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h: Add C++11 allocator support. * include/bits/hashtable.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/unordered_map: Likewise. * include/std/unordered_set: Remove bits/algobase.h include. Replace bits/alloc_traits.h by ext/alloc_traits.h. * include/std/unordered_map: Likewise. * include/ext/throw_allocator.h: Add checks on calls to allocator construct/destroy. (std::hash<__gnu_cxx::throw_value_limit>): Add conditional throw. (std::hash<__gnu_cxx::throw_value_random>): Likewise. * testsuite/util/regression/rand/priority_queue /container_rand_regression_test.tcc: Adapt. * testsuite/util/regression/rand/assoc /container_rand_regression_test.tcc: Likewise. * testsuite/util/testsuite_counter_type.h: Add count of destructors. * testsuite/23_containers/unordered_set /not_default_constructible_hash_neg.cc: Adjust dg-error line number. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: New. * testsuite/23_containers/unordered_set/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/minimal.cc: New. * testsuite/23_containers/unordered_set/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_set/allocator/swap.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multiset/allocator/swap.cc: New. * testsuite/23_containers/unordered_map/allocator/copy.cc: New. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/minimal.cc: New. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_map/allocator/swap.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multimap/allocator/swap.cc: New. From-SVN: r198158
2013-04-22 20:22:07 +00:00
{ return this->_M_cur->_M_valptr(); }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
_Node_iterator&
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
operator++() noexcept
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
{
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
this->_M_incr();
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
return *this;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
}
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
_Node_iterator
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
operator++(int) noexcept
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
{
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
_Node_iterator __tmp(*this);
this->_M_incr();
return __tmp;
}
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/// Node const_iterators, used to iterate through all the hashtable.
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
template<typename _Value, bool __constant_iterators, bool __cache>
struct _Node_const_iterator
: public _Node_iterator_base<_Value, __cache>
{
private:
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
using __base_type = _Node_iterator_base<_Value, __cache>;
using __node_type = typename __base_type::__node_type;
public:
typedef _Value value_type;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
typedef const value_type* pointer;
typedef const value_type& reference;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
_Node_const_iterator() = default;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
explicit
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
_Node_const_iterator(__node_type* __p) noexcept
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
: __base_type(__p) { }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
_Node_const_iterator(const _Node_iterator<_Value, __constant_iterators,
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
__cache>& __x) noexcept
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
: __base_type(__x._M_cur) { }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
reference
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
operator*() const noexcept
hashtable_policy.h: Add C++11 allocator support. 2013-04-22 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h: Add C++11 allocator support. * include/bits/hashtable.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/unordered_map: Likewise. * include/std/unordered_set: Remove bits/algobase.h include. Replace bits/alloc_traits.h by ext/alloc_traits.h. * include/std/unordered_map: Likewise. * include/ext/throw_allocator.h: Add checks on calls to allocator construct/destroy. (std::hash<__gnu_cxx::throw_value_limit>): Add conditional throw. (std::hash<__gnu_cxx::throw_value_random>): Likewise. * testsuite/util/regression/rand/priority_queue /container_rand_regression_test.tcc: Adapt. * testsuite/util/regression/rand/assoc /container_rand_regression_test.tcc: Likewise. * testsuite/util/testsuite_counter_type.h: Add count of destructors. * testsuite/23_containers/unordered_set /not_default_constructible_hash_neg.cc: Adjust dg-error line number. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: New. * testsuite/23_containers/unordered_set/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/minimal.cc: New. * testsuite/23_containers/unordered_set/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_set/allocator/swap.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multiset/allocator/swap.cc: New. * testsuite/23_containers/unordered_map/allocator/copy.cc: New. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/minimal.cc: New. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_map/allocator/swap.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multimap/allocator/swap.cc: New. From-SVN: r198158
2013-04-22 20:22:07 +00:00
{ return this->_M_cur->_M_v(); }
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
pointer
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
operator->() const noexcept
hashtable_policy.h: Add C++11 allocator support. 2013-04-22 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h: Add C++11 allocator support. * include/bits/hashtable.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/unordered_map: Likewise. * include/std/unordered_set: Remove bits/algobase.h include. Replace bits/alloc_traits.h by ext/alloc_traits.h. * include/std/unordered_map: Likewise. * include/ext/throw_allocator.h: Add checks on calls to allocator construct/destroy. (std::hash<__gnu_cxx::throw_value_limit>): Add conditional throw. (std::hash<__gnu_cxx::throw_value_random>): Likewise. * testsuite/util/regression/rand/priority_queue /container_rand_regression_test.tcc: Adapt. * testsuite/util/regression/rand/assoc /container_rand_regression_test.tcc: Likewise. * testsuite/util/testsuite_counter_type.h: Add count of destructors. * testsuite/23_containers/unordered_set /not_default_constructible_hash_neg.cc: Adjust dg-error line number. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: New. * testsuite/23_containers/unordered_set/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/minimal.cc: New. * testsuite/23_containers/unordered_set/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_set/allocator/swap.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multiset/allocator/swap.cc: New. * testsuite/23_containers/unordered_map/allocator/copy.cc: New. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/minimal.cc: New. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_map/allocator/swap.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multimap/allocator/swap.cc: New. From-SVN: r198158
2013-04-22 20:22:07 +00:00
{ return this->_M_cur->_M_valptr(); }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
_Node_const_iterator&
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
operator++() noexcept
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
{
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
this->_M_incr();
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
return *this;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
}
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
_Node_const_iterator
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract) 2013-09-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator->, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&), operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&, const _Node_iterator_base&), operator!=(const _Node_iterator_base&, const _Node_iterator_base&)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator->, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator->, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator&, const _Safe_iterator&), operator!=(const _Safe_iterator&, const _Safe_iterator&), operator<(const _Safe_iterator&, const _Safe_iterator&), operator<=(const _Safe_iterator&, const _Safe_iterator&), operator>(const _Safe_iterator&, const _Safe_iterator&), operator>=(const _Safe_iterator&, const _Safe_iterator&), operator-(const _Safe_iterator&, const _Safe_iterator&), operator+(difference_type, const _Safe_iterator&)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator->, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker&, const __iterator_tracker&), operator!=(const __iterator_tracker&, const __iterator_tracker&), operator<(const __iterator_tracker&, const __iterator_tracker&), operator<=(const __iterator_tracker&, const __iterator_tracker&), operator>(const __iterator_tracker&, const __iterator_tracker&), operator>=(const __iterator_tracker&, const __iterator_tracker&), operator-(const __iterator_tracker&, const __iterator_tracker&), operator+(difference_type, const __iterator_tracker&)): Likewise. From-SVN: r202924
2013-09-25 22:28:12 +02:00
operator++(int) noexcept
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
{
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
_Node_const_iterator __tmp(*this);
this->_M_incr();
return __tmp;
}
};
// Many of class template _Hashtable's template parameters are policy
// classes. These are defaults for the policies.
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/// Default range hashing function: use division to fold a large number
/// into the range [0, N).
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
struct _Mod_range_hashing
{
typedef std::size_t first_argument_type;
typedef std::size_t second_argument_type;
typedef std::size_t result_type;
result_type
hashtable_policy.h: Add C++11 allocator support. 2013-04-22 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h: Add C++11 allocator support. * include/bits/hashtable.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/unordered_map: Likewise. * include/std/unordered_set: Remove bits/algobase.h include. Replace bits/alloc_traits.h by ext/alloc_traits.h. * include/std/unordered_map: Likewise. * include/ext/throw_allocator.h: Add checks on calls to allocator construct/destroy. (std::hash<__gnu_cxx::throw_value_limit>): Add conditional throw. (std::hash<__gnu_cxx::throw_value_random>): Likewise. * testsuite/util/regression/rand/priority_queue /container_rand_regression_test.tcc: Adapt. * testsuite/util/regression/rand/assoc /container_rand_regression_test.tcc: Likewise. * testsuite/util/testsuite_counter_type.h: Add count of destructors. * testsuite/23_containers/unordered_set /not_default_constructible_hash_neg.cc: Adjust dg-error line number. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: New. * testsuite/23_containers/unordered_set/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/minimal.cc: New. * testsuite/23_containers/unordered_set/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_set/allocator/swap.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multiset/allocator/swap.cc: New. * testsuite/23_containers/unordered_map/allocator/copy.cc: New. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/minimal.cc: New. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_map/allocator/swap.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multimap/allocator/swap.cc: New. From-SVN: r198158
2013-04-22 20:22:07 +00:00
operator()(first_argument_type __num,
second_argument_type __den) const noexcept
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
{ return __num % __den; }
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/// Default ranged hash function H. In principle it should be a
/// function object composed from objects of type H1 and H2 such that
/// h(k, N) = h2(h1(k), N), but that would mean making extra copies of
/// h1 and h2. So instead we'll just use a tag to tell class template
/// hashtable to do that composition.
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
struct _Default_ranged_hash { };
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/// Default value for rehash policy. Bucket size is (usually) the
/// smallest prime that keeps the load factor small enough.
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
struct _Prime_rehash_policy
{
using __has_load_factor = true_type;
_Prime_rehash_policy(float __z = 1.0) noexcept
: _M_max_load_factor(__z), _M_next_resize(0) { }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
float
max_load_factor() const noexcept
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
{ return _M_max_load_factor; }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
// Return a bucket size no smaller than n.
std::size_t
_M_next_bkt(std::size_t __n) const;
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
// Return a bucket count appropriate for n elements
std::size_t
_M_bkt_for_elements(std::size_t __n) const
{ return __builtin_ceil(__n / (double)_M_max_load_factor); }
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
// __n_bkt is current bucket count, __n_elt is current element count,
// and __n_ins is number of elements to be inserted. Do we need to
// increase bucket count? If so, return make_pair(true, n), where n
// is the new bucket count. If not, return make_pair(false, 0).
std::pair<bool, std::size_t>
_M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt,
std::size_t __n_ins) const;
typedef std::size_t _State;
re PR libstdc++/41975 ([C++0x] [DR579] unordered_set::erase performs worse when nearly empty) 2011-11-23 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/41975 * include/bits/hashtable.h (_Hashtable<>): Major data model modification to limit performance impact of empty buckets in erase(iterator) implementation. * include/bits/hashtable_policy.h (_Hashtable_iterator, _Hashtable_const_iterator): Remove not used anymore. * include/bits/hashtable_policy.h (_Prime_rehash_policy): Remove _M_grow_factor, just use natural evolution of prime numbers. Add _M_prev_size to know when the number of buckets can be reduced. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>), unordered_map.h (__unordered_map<>, __unordered_multimap<>): Change default value of cache hash code template parameter, false for integral types with noexcept hash functor, true otherwise. * include/debug/unordered_map, unordered_set: Adapt transformation from iterator/const_iterator to respectively local_iterator/const_local_iterator. * testsuite/performance/23_containers/copy_construct/unordered_set.cc: New. * testsuite/23_containers/unordered_set/instantiation_neg.cc: New. * testsuite/23_containers/unordered_set/hash_policy/rehash.cc: New. * testsuite/23_containers/unordered_multiset/cons/copy.cc: New. * testsuite/23_containers/unordered_multiset/erase/1.cc, 24061-multiset.cc: Add checks on the number of bucket elements. * testsuite/23_containers/unordered_multiset/insert/multiset_range.cc, multiset_single.cc, multiset_single_move.cc: Likewise. From-SVN: r181677
2011-11-23 20:30:18 +00:00
_State
_M_state() const
{ return _M_next_resize; }
re PR libstdc++/41975 ([C++0x] [DR579] unordered_set::erase performs worse when nearly empty) 2011-11-23 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/41975 * include/bits/hashtable.h (_Hashtable<>): Major data model modification to limit performance impact of empty buckets in erase(iterator) implementation. * include/bits/hashtable_policy.h (_Hashtable_iterator, _Hashtable_const_iterator): Remove not used anymore. * include/bits/hashtable_policy.h (_Prime_rehash_policy): Remove _M_grow_factor, just use natural evolution of prime numbers. Add _M_prev_size to know when the number of buckets can be reduced. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>), unordered_map.h (__unordered_map<>, __unordered_multimap<>): Change default value of cache hash code template parameter, false for integral types with noexcept hash functor, true otherwise. * include/debug/unordered_map, unordered_set: Adapt transformation from iterator/const_iterator to respectively local_iterator/const_local_iterator. * testsuite/performance/23_containers/copy_construct/unordered_set.cc: New. * testsuite/23_containers/unordered_set/instantiation_neg.cc: New. * testsuite/23_containers/unordered_set/hash_policy/rehash.cc: New. * testsuite/23_containers/unordered_multiset/cons/copy.cc: New. * testsuite/23_containers/unordered_multiset/erase/1.cc, 24061-multiset.cc: Add checks on the number of bucket elements. * testsuite/23_containers/unordered_multiset/insert/multiset_range.cc, multiset_single.cc, multiset_single_move.cc: Likewise. From-SVN: r181677
2011-11-23 20:30:18 +00:00
hashtable_policy.h: Add C++11 allocator support. 2013-04-22 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h: Add C++11 allocator support. * include/bits/hashtable.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/unordered_map: Likewise. * include/std/unordered_set: Remove bits/algobase.h include. Replace bits/alloc_traits.h by ext/alloc_traits.h. * include/std/unordered_map: Likewise. * include/ext/throw_allocator.h: Add checks on calls to allocator construct/destroy. (std::hash<__gnu_cxx::throw_value_limit>): Add conditional throw. (std::hash<__gnu_cxx::throw_value_random>): Likewise. * testsuite/util/regression/rand/priority_queue /container_rand_regression_test.tcc: Adapt. * testsuite/util/regression/rand/assoc /container_rand_regression_test.tcc: Likewise. * testsuite/util/testsuite_counter_type.h: Add count of destructors. * testsuite/23_containers/unordered_set /not_default_constructible_hash_neg.cc: Adjust dg-error line number. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: New. * testsuite/23_containers/unordered_set/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/minimal.cc: New. * testsuite/23_containers/unordered_set/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_set/allocator/swap.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multiset/allocator/swap.cc: New. * testsuite/23_containers/unordered_map/allocator/copy.cc: New. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/minimal.cc: New. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_map/allocator/swap.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multimap/allocator/swap.cc: New. From-SVN: r198158
2013-04-22 20:22:07 +00:00
void
_M_reset() noexcept
{ _M_next_resize = 0; }
re PR libstdc++/41975 ([C++0x] [DR579] unordered_set::erase performs worse when nearly empty) 2011-11-23 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/41975 * include/bits/hashtable.h (_Hashtable<>): Major data model modification to limit performance impact of empty buckets in erase(iterator) implementation. * include/bits/hashtable_policy.h (_Hashtable_iterator, _Hashtable_const_iterator): Remove not used anymore. * include/bits/hashtable_policy.h (_Prime_rehash_policy): Remove _M_grow_factor, just use natural evolution of prime numbers. Add _M_prev_size to know when the number of buckets can be reduced. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>), unordered_map.h (__unordered_map<>, __unordered_multimap<>): Change default value of cache hash code template parameter, false for integral types with noexcept hash functor, true otherwise. * include/debug/unordered_map, unordered_set: Adapt transformation from iterator/const_iterator to respectively local_iterator/const_local_iterator. * testsuite/performance/23_containers/copy_construct/unordered_set.cc: New. * testsuite/23_containers/unordered_set/instantiation_neg.cc: New. * testsuite/23_containers/unordered_set/hash_policy/rehash.cc: New. * testsuite/23_containers/unordered_multiset/cons/copy.cc: New. * testsuite/23_containers/unordered_multiset/erase/1.cc, 24061-multiset.cc: Add checks on the number of bucket elements. * testsuite/23_containers/unordered_multiset/insert/multiset_range.cc, multiset_single.cc, multiset_single_move.cc: Likewise. From-SVN: r181677
2011-11-23 20:30:18 +00:00
void
_M_reset(_State __state)
{ _M_next_resize = __state; }
re PR libstdc++/41975 ([C++0x] [DR579] unordered_set::erase performs worse when nearly empty) 2011-11-23 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/41975 * include/bits/hashtable.h (_Hashtable<>): Major data model modification to limit performance impact of empty buckets in erase(iterator) implementation. * include/bits/hashtable_policy.h (_Hashtable_iterator, _Hashtable_const_iterator): Remove not used anymore. * include/bits/hashtable_policy.h (_Prime_rehash_policy): Remove _M_grow_factor, just use natural evolution of prime numbers. Add _M_prev_size to know when the number of buckets can be reduced. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>), unordered_map.h (__unordered_map<>, __unordered_multimap<>): Change default value of cache hash code template parameter, false for integral types with noexcept hash functor, true otherwise. * include/debug/unordered_map, unordered_set: Adapt transformation from iterator/const_iterator to respectively local_iterator/const_local_iterator. * testsuite/performance/23_containers/copy_construct/unordered_set.cc: New. * testsuite/23_containers/unordered_set/instantiation_neg.cc: New. * testsuite/23_containers/unordered_set/hash_policy/rehash.cc: New. * testsuite/23_containers/unordered_multiset/cons/copy.cc: New. * testsuite/23_containers/unordered_multiset/erase/1.cc, 24061-multiset.cc: Add checks on the number of bucket elements. * testsuite/23_containers/unordered_multiset/insert/multiset_range.cc, multiset_single.cc, multiset_single_move.cc: Likewise. From-SVN: r181677
2011-11-23 20:30:18 +00:00
static const std::size_t _S_growth_factor = 2;
float _M_max_load_factor;
mutable std::size_t _M_next_resize;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
};
/// Range hashing function assuming that second arg is a power of 2.
struct _Mask_range_hashing
{
typedef std::size_t first_argument_type;
typedef std::size_t second_argument_type;
typedef std::size_t result_type;
result_type
operator()(first_argument_type __num,
second_argument_type __den) const noexcept
{ return __num & (__den - 1); }
};
/// Compute closest power of 2 not less than __n
inline std::size_t
__clp2(std::size_t __n) noexcept
{
using __gnu_cxx::__int_traits;
// Equivalent to return __n ? std::bit_ceil(__n) : 0;
if (__n < 2)
return __n;
const unsigned __lz = sizeof(size_t) > sizeof(long)
? __builtin_clzll(__n - 1ull)
: __builtin_clzl(__n - 1ul);
// Doing two shifts avoids undefined behaviour when __lz == 0.
return (size_t(1) << (__int_traits<size_t>::__digits - __lz - 1)) << 1;
}
/// Rehash policy providing power of 2 bucket numbers. Avoids modulo
/// operations.
struct _Power2_rehash_policy
{
using __has_load_factor = true_type;
_Power2_rehash_policy(float __z = 1.0) noexcept
: _M_max_load_factor(__z), _M_next_resize(0) { }
float
max_load_factor() const noexcept
{ return _M_max_load_factor; }
// Return a bucket size no smaller than n (as long as n is not above the
// highest power of 2).
std::size_t
_M_next_bkt(std::size_t __n) noexcept
{
if (__n == 0)
// Special case on container 1st initialization with 0 bucket count
// hint. We keep _M_next_resize to 0 to make sure that next time we
// want to add an element allocation will take place.
return 1;
const auto __max_width = std::min<size_t>(sizeof(size_t), 8);
const auto __max_bkt = size_t(1) << (__max_width * __CHAR_BIT__ - 1);
std::size_t __res = __clp2(__n);
if (__res == 0)
__res = __max_bkt;
else if (__res == 1)
// If __res is 1 we force it to 2 to make sure there will be an
// allocation so that nothing need to be stored in the initial
// single bucket
__res = 2;
if (__res == __max_bkt)
// Set next resize to the max value so that we never try to rehash again
// as we already reach the biggest possible bucket number.
// Note that it might result in max_load_factor not being respected.
_M_next_resize = size_t(-1);
else
_M_next_resize
= __builtin_floor(__res * (double)_M_max_load_factor);
return __res;
}
// Return a bucket count appropriate for n elements
std::size_t
_M_bkt_for_elements(std::size_t __n) const noexcept
{ return __builtin_ceil(__n / (double)_M_max_load_factor); }
// __n_bkt is current bucket count, __n_elt is current element count,
// and __n_ins is number of elements to be inserted. Do we need to
// increase bucket count? If so, return make_pair(true, n), where n
// is the new bucket count. If not, return make_pair(false, 0).
std::pair<bool, std::size_t>
_M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt,
std::size_t __n_ins) noexcept
{
if (__n_elt + __n_ins > _M_next_resize)
{
// If _M_next_resize is 0 it means that we have nothing allocated so
// far and that we start inserting elements. In this case we start
// with an initial bucket size of 11.
double __min_bkts
= std::max<std::size_t>(__n_elt + __n_ins, _M_next_resize ? 0 : 11)
/ (double)_M_max_load_factor;
if (__min_bkts >= __n_bkt)
return { true,
_M_next_bkt(std::max<std::size_t>(__builtin_floor(__min_bkts) + 1,
__n_bkt * _S_growth_factor)) };
_M_next_resize
= __builtin_floor(__n_bkt * (double)_M_max_load_factor);
return { false, 0 };
}
else
return { false, 0 };
}
typedef std::size_t _State;
_State
_M_state() const noexcept
{ return _M_next_resize; }
void
_M_reset() noexcept
{ _M_next_resize = 0; }
void
_M_reset(_State __state) noexcept
{ _M_next_resize = __state; }
static const std::size_t _S_growth_factor = 2;
float _M_max_load_factor;
std::size_t _M_next_resize;
};
// Base classes for std::_Hashtable. We define these base classes
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
// because in some cases we want to do different things depending on
// the value of a policy class. In some cases the policy class
// affects which member functions and nested typedefs are defined;
// we handle that by specializing base class templates. Several of
// the base class templates need to access other members of class
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
// template _Hashtable, so we use a variant of the "Curiously
// Recurring Template Pattern" (CRTP) technique.
/**
* Primary class template _Map_base.
*
* If the hashtable has a value type of the form pair<T1, T2> and a
* key extraction policy (_ExtractKey) that returns the first part
* of the pair, the hashtable gets a mapped_type typedef. If it
* satisfies those criteria and also has unique keys, then it also
* gets an operator[].
*/
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits,
bool _Unique_keys = _Traits::__unique_keys::value>
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
struct _Map_base { };
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/// Partial specialization, __unique_keys set to false.
template<typename _Key, typename _Pair, typename _Alloc, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
struct _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, false>
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
{
using mapped_type = typename std::tuple_element<1, _Pair>::type;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/// Partial specialization, __unique_keys set to true.
template<typename _Key, typename _Pair, typename _Alloc, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
struct _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, true>
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
{
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
private:
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
using __hashtable_base = _Hashtable_base<_Key, _Pair, _Select1st, _Equal,
_Hash, _RangeHash, _Unused,
_Traits>;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
using __hashtable = _Hashtable<_Key, _Pair, _Alloc, _Select1st, _Equal,
_Hash, _RangeHash,
_Unused, _RehashPolicy, _Traits>;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
using __hash_code = typename __hashtable_base::__hash_code;
public:
using key_type = typename __hashtable_base::key_type;
using mapped_type = typename std::tuple_element<1, _Pair>::type;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
mapped_type&
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
operator[](const key_type& __k);
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
2010-10-28 16:01:05 +00:00
mapped_type&
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
operator[](key_type&& __k);
2010-10-28 16:01:05 +00:00
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 761. unordered_map needs an at() member function.
mapped_type&
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
at(const key_type& __k);
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
const mapped_type&
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
at(const key_type& __k) const;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _Key, typename _Pair, typename _Alloc, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
auto
_Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, true>::
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
operator[](const key_type& __k)
-> mapped_type&
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
{
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
__hashtable* __h = static_cast<__hashtable*>(this);
__hash_code __code = __h->_M_hash_code(__k);
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
std::size_t __bkt = __h->_M_bucket_index(__code);
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
if (auto __node = __h->_M_find_node(__bkt, __k, __code))
2019-06-17 10:25:04 +00:00
return __node->_M_v().second;
typename __hashtable::_Scoped_node __node {
__h,
std::piecewise_construct,
std::tuple<const key_type&>(__k),
std::tuple<>()
};
auto __pos
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
= __h->_M_insert_unique_node(__bkt, __code, __node._M_node);
2019-06-17 10:25:04 +00:00
__node._M_node = nullptr;
return __pos->second;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
}
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _Key, typename _Pair, typename _Alloc, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
auto
_Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, true>::
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
operator[](key_type&& __k)
-> mapped_type&
2010-10-28 16:01:05 +00:00
{
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
__hashtable* __h = static_cast<__hashtable*>(this);
__hash_code __code = __h->_M_hash_code(__k);
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
std::size_t __bkt = __h->_M_bucket_index(__code);
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
if (auto __node = __h->_M_find_node(__bkt, __k, __code))
2019-06-17 10:25:04 +00:00
return __node->_M_v().second;
typename __hashtable::_Scoped_node __node {
__h,
std::piecewise_construct,
std::forward_as_tuple(std::move(__k)),
std::tuple<>()
};
auto __pos
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
= __h->_M_insert_unique_node(__bkt, __code, __node._M_node);
2019-06-17 10:25:04 +00:00
__node._M_node = nullptr;
return __pos->second;
2010-10-28 16:01:05 +00:00
}
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _Key, typename _Pair, typename _Alloc, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
auto
_Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, true>::
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
at(const key_type& __k)
-> mapped_type&
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
{
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
__hashtable* __h = static_cast<__hashtable*>(this);
auto __ite = __h->find(__k);
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
if (!__ite._M_cur)
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
__throw_out_of_range(__N("_Map_base::at"));
return __ite->second;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
}
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _Key, typename _Pair, typename _Alloc, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
auto
_Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, true>::
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
at(const key_type& __k) const
-> const mapped_type&
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
{
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
const __hashtable* __h = static_cast<const __hashtable*>(this);
auto __ite = __h->find(__k);
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
if (!__ite._M_cur)
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
__throw_out_of_range(__N("_Map_base::at"));
return __ite->second;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
}
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/**
* Primary class template _Insert_base.
*
* Defines @c insert member functions appropriate to all _Hashtables.
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
*/
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
struct _Insert_base
{
protected:
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
using __hashtable_base = _Hashtable_base<_Key, _Value, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Equal, _Hash, _RangeHash,
_Unused, _Traits>;
using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal,
_Hash, _RangeHash,
_Unused, _RehashPolicy, _Traits>;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
using __hash_cached = typename _Traits::__hash_cached;
using __constant_iterators = typename _Traits::__constant_iterators;
using __hashtable_alloc = _Hashtable_alloc<
__alloc_rebind<_Alloc, _Hash_node<_Value,
__hash_cached::value>>>;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
using value_type = typename __hashtable_base::value_type;
using size_type = typename __hashtable_base::size_type;
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
using __unique_keys = typename _Traits::__unique_keys;
using __node_alloc_type = typename __hashtable_alloc::__node_alloc_type;
using __node_gen_type = _AllocNode<__node_alloc_type>;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
__hashtable&
_M_conjure_hashtable()
{ return *(static_cast<__hashtable*>(this)); }
template<typename _InputIterator, typename _NodeGetter>
void
_M_insert_range(_InputIterator __first, _InputIterator __last,
const _NodeGetter&, true_type __uks);
template<typename _InputIterator, typename _NodeGetter>
void
_M_insert_range(_InputIterator __first, _InputIterator __last,
const _NodeGetter&, false_type __uks);
public:
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
using iterator = _Node_iterator<_Value, __constant_iterators::value,
__hash_cached::value>;
using const_iterator = _Node_const_iterator<_Value, __constant_iterators::value,
__hash_cached::value>;
using __ireturn_type = typename std::conditional<__unique_keys::value,
std::pair<iterator, bool>,
iterator>::type;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
__ireturn_type
insert(const value_type& __v)
{
__hashtable& __h = _M_conjure_hashtable();
__node_gen_type __node_gen(__h);
return __h._M_insert(__v, __node_gen, __unique_keys{});
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
}
iterator
insert(const_iterator __hint, const value_type& __v)
{
__hashtable& __h = _M_conjure_hashtable();
__node_gen_type __node_gen(__h);
return __h._M_insert(__hint, __v, __node_gen, __unique_keys{});
}
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
template<typename _KType, typename... _Args>
std::pair<iterator, bool>
try_emplace(const_iterator, _KType&& __k, _Args&&... __args)
{
__hashtable& __h = _M_conjure_hashtable();
auto __code = __h._M_hash_code(__k);
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
std::size_t __bkt = __h._M_bucket_index(__code);
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
if (auto __node = __h._M_find_node(__bkt, __k, __code))
return { iterator(__node), false };
typename __hashtable::_Scoped_node __node {
&__h,
std::piecewise_construct,
std::forward_as_tuple(std::forward<_KType>(__k)),
std::forward_as_tuple(std::forward<_Args>(__args)...)
};
auto __it
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
= __h._M_insert_unique_node(__bkt, __code, __node._M_node);
__node._M_node = nullptr;
return { __it, true };
}
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
void
insert(initializer_list<value_type> __l)
{ this->insert(__l.begin(), __l.end()); }
template<typename _InputIterator>
void
insert(_InputIterator __first, _InputIterator __last)
{
__hashtable& __h = _M_conjure_hashtable();
__node_gen_type __node_gen(__h);
return _M_insert_range(__first, __last, __node_gen, __unique_keys{});
}
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
};
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
template<typename _InputIterator, typename _NodeGetter>
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
void
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal,
_Hash, _RangeHash, _Unused,
_RehashPolicy, _Traits>::
_M_insert_range(_InputIterator __first, _InputIterator __last,
const _NodeGetter& __node_gen, true_type __uks)
{
__hashtable& __h = _M_conjure_hashtable();
for (; __first != __last; ++__first)
__h._M_insert(*__first, __node_gen, __uks);
}
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
typename _RehashPolicy, typename _Traits>
template<typename _InputIterator, typename _NodeGetter>
void
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal,
_Hash, _RangeHash, _Unused,
_RehashPolicy, _Traits>::
_M_insert_range(_InputIterator __first, _InputIterator __last,
const _NodeGetter& __node_gen, false_type __uks)
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
{
using __rehash_type = typename __hashtable::__rehash_type;
using __rehash_state = typename __hashtable::__rehash_state;
using pair_type = std::pair<bool, std::size_t>;
size_type __n_elt = __detail::__distance_fw(__first, __last);
if (__n_elt == 0)
return;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
__hashtable& __h = _M_conjure_hashtable();
__rehash_type& __rehash = __h._M_rehash_policy;
const __rehash_state& __saved_state = __rehash._M_state();
pair_type __do_rehash = __rehash._M_need_rehash(__h._M_bucket_count,
__h._M_element_count,
__n_elt);
if (__do_rehash.first)
__h._M_rehash(__do_rehash.second, __saved_state);
for (; __first != __last; ++__first)
__h._M_insert(*__first, __node_gen, __uks);
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
}
/**
* Primary class template _Insert.
*
* Defines @c insert member functions that depend on _Hashtable policies,
* via partial specializations.
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
*/
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits,
bool _Constant_iterators = _Traits::__constant_iterators::value>
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
struct _Insert;
/// Specialization.
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
struct _Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal,
_Hash, _RangeHash, _Unused,
_RehashPolicy, _Traits, true>
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
: public _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
{
using __base_type = _Insert_base<_Key, _Value, _Alloc, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Equal, _Hash, _RangeHash, _Unused,
_RehashPolicy, _Traits>;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
using value_type = typename __base_type::value_type;
using iterator = typename __base_type::iterator;
using const_iterator = typename __base_type::const_iterator;
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
using __ireturn_type = typename __base_type::__ireturn_type;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
using __unique_keys = typename __base_type::__unique_keys;
using __hashtable = typename __base_type::__hashtable;
using __node_gen_type = typename __base_type::__node_gen_type;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
using __base_type::insert;
__ireturn_type
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
insert(value_type&& __v)
{
__hashtable& __h = this->_M_conjure_hashtable();
__node_gen_type __node_gen(__h);
return __h._M_insert(std::move(__v), __node_gen, __unique_keys{});
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
}
iterator
insert(const_iterator __hint, value_type&& __v)
{
__hashtable& __h = this->_M_conjure_hashtable();
__node_gen_type __node_gen(__h);
return __h._M_insert(__hint, std::move(__v), __node_gen,
__unique_keys{});
}
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/// Specialization.
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
typename _RehashPolicy, typename _Traits>
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
struct _Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal,
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, false>
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
: public _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
{
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
using __base_type = _Insert_base<_Key, _Value, _Alloc, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Equal, _Hash, _RangeHash, _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
_RehashPolicy, _Traits>;
using value_type = typename __base_type::value_type;
using iterator = typename __base_type::iterator;
using const_iterator = typename __base_type::const_iterator;
using __unique_keys = typename __base_type::__unique_keys;
using __hashtable = typename __base_type::__hashtable;
using __ireturn_type = typename __base_type::__ireturn_type;
using __base_type::insert;
template<typename _Pair>
using __is_cons = std::is_constructible<value_type, _Pair&&>;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _Pair>
using _IFcons = std::enable_if<__is_cons<_Pair>::value>;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _Pair>
using _IFconsp = typename _IFcons<_Pair>::type;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _Pair, typename = _IFconsp<_Pair>>
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
__ireturn_type
insert(_Pair&& __v)
{
__hashtable& __h = this->_M_conjure_hashtable();
return __h._M_emplace(__unique_keys{}, std::forward<_Pair>(__v));
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
}
template<typename _Pair, typename = _IFconsp<_Pair>>
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
iterator
insert(const_iterator __hint, _Pair&& __v)
{
__hashtable& __h = this->_M_conjure_hashtable();
return __h._M_emplace(__hint, __unique_keys{},
std::forward<_Pair>(__v));
}
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
};
template<typename _Policy>
using __has_load_factor = typename _Policy::__has_load_factor;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/**
* Primary class template _Rehash_base.
*
* Give hashtable the max_load_factor functions and reserve iff the
* rehash policy supports it.
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
*/
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
typename _RehashPolicy, typename _Traits,
typename =
__detected_or_t<false_type, __has_load_factor, _RehashPolicy>>
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
struct _Rehash_base;
/// Specialization when rehash policy doesn't provide load factor management.
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
typename _RehashPolicy, typename _Traits>
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
struct _Rehash_base<_Key, _Value, _Alloc, _ExtractKey, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits,
false_type /* Has load factor */>
{
};
/// Specialization when rehash policy provide load factor management.
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
typename _RehashPolicy, typename _Traits>
struct _Rehash_base<_Key, _Value, _Alloc, _ExtractKey, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits,
true_type /* Has load factor */>
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
{
using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Equal, _Hash, _RangeHash, _Unused,
_RehashPolicy, _Traits>;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
float
max_load_factor() const noexcept
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
{
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
const __hashtable* __this = static_cast<const __hashtable*>(this);
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
return __this->__rehash_policy().max_load_factor();
}
void
max_load_factor(float __z)
{
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
__hashtable* __this = static_cast<__hashtable*>(this);
__this->__rehash_policy(_RehashPolicy(__z));
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
}
void
reserve(std::size_t __n)
{
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
__hashtable* __this = static_cast<__hashtable*>(this);
__this->rehash(__this->__rehash_policy()._M_bkt_for_elements(__n));
}
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/**
* Primary class template _Hashtable_ebo_helper.
*
* Helper class using EBO when it is not forbidden (the type is not
* final) and when it is worth it (the type is empty.)
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
*/
template<int _Nm, typename _Tp,
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
bool __use_ebo = !__is_final(_Tp) && __is_empty(_Tp)>
struct _Hashtable_ebo_helper;
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/// Specialization using EBO.
template<int _Nm, typename _Tp>
struct _Hashtable_ebo_helper<_Nm, _Tp, true>
: private _Tp
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
{
_Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _OtherTp>
_Hashtable_ebo_helper(_OtherTp&& __tp)
: _Tp(std::forward<_OtherTp>(__tp))
{ }
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
const _Tp& _M_cget() const { return static_cast<const _Tp&>(*this); }
_Tp& _M_get() { return static_cast<_Tp&>(*this); }
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/// Specialization not using EBO.
template<int _Nm, typename _Tp>
struct _Hashtable_ebo_helper<_Nm, _Tp, false>
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
{
_Hashtable_ebo_helper() = default;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _OtherTp>
_Hashtable_ebo_helper(_OtherTp&& __tp)
: _M_tp(std::forward<_OtherTp>(__tp))
{ }
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
const _Tp& _M_cget() const { return _M_tp; }
_Tp& _M_get() { return _M_tp; }
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
private:
_Tp _M_tp{};
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
};
/**
* Primary class template _Local_iterator_base.
*
* Base class for local iterators, used to iterate within a bucket
* but not between buckets.
*/
template<typename _Key, typename _Value, typename _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
bool __cache_hash_code>
struct _Local_iterator_base;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/**
* Primary class template _Hash_code_base.
*
* Encapsulates two policy issues that aren't quite orthogonal.
* (1) the difference between using a ranged hash function and using
* the combination of a hash function and a range-hashing function.
* In the former case we don't have such things as hash codes, so
* we have a dummy type as placeholder.
* (2) Whether or not we cache hash codes. Caching hash codes is
* meaningless if we have a ranged hash function.
*
* We also put the key extraction objects here, for convenience.
* Each specialization derives from one or more of the template
* parameters to benefit from Ebo. This is important as this type
* is inherited in some cases by the _Local_iterator_base type used
* to implement local_iterator and const_local_iterator. As with
* any iterator type we prefer to make it as small as possible.
*/
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
template<typename _Key, typename _Value, typename _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
bool __cache_hash_code>
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
struct _Hash_code_base
: private _Hashtable_ebo_helper<1, _Hash>
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
{
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
private:
using __ebo_hash = _Hashtable_ebo_helper<1, _Hash>;
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
// Gives the local iterator implementation access to _M_bucket_index().
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
friend struct _Local_iterator_base<_Key, _Value, _ExtractKey,
_Hash, _RangeHash, _Unused, false>;
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
public:
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typedef _Hash hasher;
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
hasher
hash_function() const
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
{ return _M_hash(); }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
protected:
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typedef std::size_t __hash_code;
// We need the default constructor for the local iterators and _Hashtable
// default constructor.
_Hash_code_base() = default;
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash_code_base(const _Hash& __hash) : __ebo_hash(__hash) { }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
__hash_code
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
_M_hash_code(const _Key& __k) const
PR libstdc++/85965 move is_invocable assertions again This is another attempt to reduce how often the assertions are evaluated, so that code which doesn't try to use the function objects doesn't need them to be invocable. For _Rb_tree we access the _M_key_compare object directly, so can't put the assertions in an accessor function for it. However, every invocation of _M_key_compare is accompanied by a use of _S_key, so the assertions can be put in there. For _Hashtable there are member functions that are consistently used to obtain a hash code or test for equality, so the assertions can go in those members. PR libstdc++/85965 * include/bits/hashtable.h (_Hashtable::~_Hashtable()): Remove static assertions from the destructor. * include/bits/hashtable_policy.h (_Hash_code_base::_M_hash_code): Move static_assert for hash function to here. (_Hash_table_base::_M_equals): Move static_assert for equality predicate to here. * include/bits/stl_tree.h (_Rb_tree::_S_value(_Const_Link_type)): Remove. (_Rb_tree::_S_key(_Const_Link_type)): Move assertions here. Access the value directly instead of calling _S_value. (_Rb_tree::_S_value(_Const_Base_ptr)): Remove. (_Rb_tree::_S_key(_Const_Base_ptr)): Do downcast and forward to _S_key(_Const_Link_type). * testsuite/23_containers/set/85965.cc: Check construction, destruction, assignment and size() do not trigger the assertions. * testsuite/23_containers/unordered_set/85965.cc: Likewise. * testsuite/23_containers/map/48101_neg.cc: Call find and adjust expected errors. * testsuite/23_containers/multimap/48101_neg.cc: Likewise. * testsuite/23_containers/multiset/48101_neg.cc: Likewise. * testsuite/23_containers/set/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_map/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_set/48101_neg.cc: Likewise. From-SVN: r271323
2019-05-17 15:13:32 +01:00
{
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
static_assert(__is_invocable<const _Hash&, const _Key&>{},
PR libstdc++/85965 move is_invocable assertions again This is another attempt to reduce how often the assertions are evaluated, so that code which doesn't try to use the function objects doesn't need them to be invocable. For _Rb_tree we access the _M_key_compare object directly, so can't put the assertions in an accessor function for it. However, every invocation of _M_key_compare is accompanied by a use of _S_key, so the assertions can be put in there. For _Hashtable there are member functions that are consistently used to obtain a hash code or test for equality, so the assertions can go in those members. PR libstdc++/85965 * include/bits/hashtable.h (_Hashtable::~_Hashtable()): Remove static assertions from the destructor. * include/bits/hashtable_policy.h (_Hash_code_base::_M_hash_code): Move static_assert for hash function to here. (_Hash_table_base::_M_equals): Move static_assert for equality predicate to here. * include/bits/stl_tree.h (_Rb_tree::_S_value(_Const_Link_type)): Remove. (_Rb_tree::_S_key(_Const_Link_type)): Move assertions here. Access the value directly instead of calling _S_value. (_Rb_tree::_S_value(_Const_Base_ptr)): Remove. (_Rb_tree::_S_key(_Const_Base_ptr)): Do downcast and forward to _S_key(_Const_Link_type). * testsuite/23_containers/set/85965.cc: Check construction, destruction, assignment and size() do not trigger the assertions. * testsuite/23_containers/unordered_set/85965.cc: Likewise. * testsuite/23_containers/map/48101_neg.cc: Call find and adjust expected errors. * testsuite/23_containers/multimap/48101_neg.cc: Likewise. * testsuite/23_containers/multiset/48101_neg.cc: Likewise. * testsuite/23_containers/set/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_map/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_set/48101_neg.cc: Likewise. From-SVN: r271323
2019-05-17 15:13:32 +01:00
"hash function must be invocable with an argument of key type");
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
return _M_hash()(__k);
PR libstdc++/85965 move is_invocable assertions again This is another attempt to reduce how often the assertions are evaluated, so that code which doesn't try to use the function objects doesn't need them to be invocable. For _Rb_tree we access the _M_key_compare object directly, so can't put the assertions in an accessor function for it. However, every invocation of _M_key_compare is accompanied by a use of _S_key, so the assertions can be put in there. For _Hashtable there are member functions that are consistently used to obtain a hash code or test for equality, so the assertions can go in those members. PR libstdc++/85965 * include/bits/hashtable.h (_Hashtable::~_Hashtable()): Remove static assertions from the destructor. * include/bits/hashtable_policy.h (_Hash_code_base::_M_hash_code): Move static_assert for hash function to here. (_Hash_table_base::_M_equals): Move static_assert for equality predicate to here. * include/bits/stl_tree.h (_Rb_tree::_S_value(_Const_Link_type)): Remove. (_Rb_tree::_S_key(_Const_Link_type)): Move assertions here. Access the value directly instead of calling _S_value. (_Rb_tree::_S_value(_Const_Base_ptr)): Remove. (_Rb_tree::_S_key(_Const_Base_ptr)): Do downcast and forward to _S_key(_Const_Link_type). * testsuite/23_containers/set/85965.cc: Check construction, destruction, assignment and size() do not trigger the assertions. * testsuite/23_containers/unordered_set/85965.cc: Likewise. * testsuite/23_containers/map/48101_neg.cc: Call find and adjust expected errors. * testsuite/23_containers/multimap/48101_neg.cc: Likewise. * testsuite/23_containers/multiset/48101_neg.cc: Likewise. * testsuite/23_containers/set/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_map/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_set/48101_neg.cc: Likewise. From-SVN: r271323
2019-05-17 15:13:32 +01:00
}
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
libstdc++: Add unordered containers heterogeneous lookup Add unordered containers heterogeneous lookup member functions find, count, contains and equal_range in C++20. Those members are considered for overload resolution only if hash and equal functors used to instantiate the container have a nested is_transparent type. libstdc++-v3/ChangeLog: * include/bits/stl_tree.h (__has_is_transparent, __has_is_transparent_t): Move... * include/bits/stl_function.h: ...here. * include/bits/hashtable_policy.h (_Hash_code_base<>::_M_hash_code_tr): New.. (_Hashtable_base<>::_M_equals_tr): New. * include/bits/hashtable.h (_Hashtable<>::_M_find_tr, _Hashtable<>::_M_count_tr, _Hashtable<>::_M_equal_range_tr): New member function templates to perform heterogeneous lookup. (_Hashtable<>::_M_find_before_node_tr): New. (_Hashtable<>::_M_find_node_tr): New. * include/bits/unordered_map.h (unordered_map::find<>, unordered_map::count<>, unordered_map::contains<>, unordered_map::equal_range<>): New member function templates to perform heterogeneous lookup. (unordered_multimap::find<>, unordered_multimap::count<>, unordered_multimap::contains<>, unordered_multimap::equal_range<>): Likewise. * include/bits/unordered_set.h (unordered_set::find<>, unordered_set::count<>, unordered_set::contains<>, unordered_set::equal_range<>): Likewise. (unordered_multiset::find<>, unordered_multiset::count<>, unordered_multiset::contains<>, unordered_multiset::equal_range<>): Likewise. * include/debug/unordered_map (unordered_map::find<>, unordered_map::equal_range<>): Likewise. (unordered_multimap::find<>, unordered_multimap::equal_range<>): Likewise. * include/debug/unordered_set (unordered_set::find<>, unordered_set::equal_range<>): Likewise. (unordered_multiset::find<>, unordered_multiset::equal_range<>): Likewise. * testsuite/23_containers/unordered_map/operations/1.cc: New test. * testsuite/23_containers/unordered_multimap/operations/1.cc: New test. * testsuite/23_containers/unordered_multiset/operations/1.cc: New test. * testsuite/23_containers/unordered_set/operations/1.cc: New test.
2020-11-30 20:57:16 +01:00
template<typename _Kt>
__hash_code
_M_hash_code_tr(const _Kt& __k) const
{
static_assert(__is_invocable<const _Hash&, const _Kt&>{},
"hash function must be invocable with an argument of key type");
return _M_hash()(__k);
}
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
std::size_t
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_M_bucket_index(__hash_code __c, std::size_t __bkt_count) const
{ return _RangeHash{}(__c, __bkt_count); }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
std::size_t
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_M_bucket_index(const _Hash_node_value<_Value, false>& __n,
std::size_t __bkt_count) const
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
noexcept( noexcept(declval<const _Hash&>()(declval<const _Key&>()))
&& noexcept(declval<const _RangeHash&>()((__hash_code)0,
(std::size_t)0)) )
{
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
return _RangeHash{}(_M_hash_code(_ExtractKey{}(__n._M_v())),
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
__bkt_count);
}
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
std::size_t
_M_bucket_index(const _Hash_node_value<_Value, true>& __n,
std::size_t __bkt_count) const
noexcept( noexcept(declval<const _RangeHash&>()((__hash_code)0,
(std::size_t)0)) )
{ return _RangeHash{}(__n._M_hash_code, __bkt_count); }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
void
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_M_store_code(_Hash_node_code_cache<false>&, __hash_code) const
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
{ }
void
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_M_copy_code(_Hash_node_code_cache<false>&,
const _Hash_node_code_cache<false>&) const
{ }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
void
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_M_store_code(_Hash_node_code_cache<true>& __n, __hash_code __c) const
{ __n._M_hash_code = __c; }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
void
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_M_copy_code(_Hash_node_code_cache<true>& __to,
const _Hash_node_code_cache<true>& __from) const
{ __to._M_hash_code = __from._M_hash_code; }
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
void
_M_swap(_Hash_code_base& __x)
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
{ std::swap(__ebo_hash::_M_get(), __x.__ebo_hash::_M_get()); }
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
const _Hash&
_M_hash() const { return __ebo_hash::_M_cget(); }
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
};
/// Partial specialization used when nodes contain a cached hash code.
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
template<typename _Key, typename _Value, typename _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused>
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
struct _Local_iterator_base<_Key, _Value, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, true>
: public _Node_iterator_base<_Value, true>
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
{
protected:
using __base_node_iter = _Node_iterator_base<_Value, true>;
using __hash_code_base = _Hash_code_base<_Key, _Value, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, true>;
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
_Local_iterator_base() = default;
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Local_iterator_base(const __hash_code_base&,
_Hash_node<_Value, true>* __p,
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
std::size_t __bkt, std::size_t __bkt_count)
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
: __base_node_iter(__p), _M_bucket(__bkt), _M_bucket_count(__bkt_count)
{ }
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
void
_M_incr()
{
__base_node_iter::_M_incr();
if (this->_M_cur)
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
{
std::size_t __bkt
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
= _RangeHash{}(this->_M_cur->_M_hash_code, _M_bucket_count);
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
if (__bkt != _M_bucket)
this->_M_cur = nullptr;
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
}
}
std::size_t _M_bucket;
std::size_t _M_bucket_count;
public:
std::size_t
_M_get_bucket() const { return _M_bucket; } // for debug mode
};
// Uninitialized storage for a _Hash_code_base.
// This type is DefaultConstructible and Assignable even if the
// _Hash_code_base type isn't, so that _Local_iterator_base<..., false>
// can be DefaultConstructible and Assignable.
template<typename _Tp, bool _IsEmpty = std::is_empty<_Tp>::value>
struct _Hash_code_storage
{
__gnu_cxx::__aligned_buffer<_Tp> _M_storage;
_Tp*
_M_h() { return _M_storage._M_ptr(); }
const _Tp*
_M_h() const { return _M_storage._M_ptr(); }
};
// Empty partial specialization for empty _Hash_code_base types.
template<typename _Tp>
struct _Hash_code_storage<_Tp, true>
{
static_assert( std::is_empty<_Tp>::value, "Type must be empty" );
// As _Tp is an empty type there will be no bytes written/read through
// the cast pointer, so no strict-aliasing violation.
_Tp*
_M_h() { return reinterpret_cast<_Tp*>(this); }
const _Tp*
_M_h() const { return reinterpret_cast<const _Tp*>(this); }
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
};
template<typename _Key, typename _Value, typename _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused>
using __hash_code_for_local_iter
= _Hash_code_storage<_Hash_code_base<_Key, _Value, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, false>>;
// Partial specialization used when hash codes are not cached
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
template<typename _Key, typename _Value, typename _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused>
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
struct _Local_iterator_base<_Key, _Value, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, false>
: __hash_code_for_local_iter<_Key, _Value, _ExtractKey, _Hash, _RangeHash,
_Unused>
, _Node_iterator_base<_Value, false>
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
{
protected:
using __hash_code_base = _Hash_code_base<_Key, _Value, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, false>;
using __node_iter_base = _Node_iterator_base<_Value, false>;
_Local_iterator_base() : _M_bucket_count(-1) { }
_Local_iterator_base(const __hash_code_base& __base,
_Hash_node<_Value, false>* __p,
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
std::size_t __bkt, std::size_t __bkt_count)
: __node_iter_base(__p), _M_bucket(__bkt), _M_bucket_count(__bkt_count)
{ _M_init(__base); }
~_Local_iterator_base()
{
if (_M_bucket_count != size_t(-1))
_M_destroy();
}
_Local_iterator_base(const _Local_iterator_base& __iter)
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
: __node_iter_base(__iter._M_cur), _M_bucket(__iter._M_bucket)
, _M_bucket_count(__iter._M_bucket_count)
{
if (_M_bucket_count != size_t(-1))
_M_init(*__iter._M_h());
}
_Local_iterator_base&
operator=(const _Local_iterator_base& __iter)
{
if (_M_bucket_count != -1)
_M_destroy();
this->_M_cur = __iter._M_cur;
_M_bucket = __iter._M_bucket;
_M_bucket_count = __iter._M_bucket_count;
if (_M_bucket_count != -1)
_M_init(*__iter._M_h());
return *this;
}
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
void
_M_incr()
{
__node_iter_base::_M_incr();
if (this->_M_cur)
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
{
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
std::size_t __bkt = this->_M_h()->_M_bucket_index(*this->_M_cur,
_M_bucket_count);
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
if (__bkt != _M_bucket)
this->_M_cur = nullptr;
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
}
}
std::size_t _M_bucket;
std::size_t _M_bucket_count;
void
_M_init(const __hash_code_base& __base)
{ ::new(this->_M_h()) __hash_code_base(__base); }
void
_M_destroy() { this->_M_h()->~__hash_code_base(); }
public:
std::size_t
_M_get_bucket() const { return _M_bucket; } // for debug mode
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/// local iterators
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
template<typename _Key, typename _Value, typename _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
bool __constant_iterators, bool __cache>
struct _Local_iterator
: public _Local_iterator_base<_Key, _Value, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, __cache>
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
{
private:
using __base_type = _Local_iterator_base<_Key, _Value, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, __cache>;
using __hash_code_base = typename __base_type::__hash_code_base;
public:
typedef _Value value_type;
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
typedef typename std::conditional<__constant_iterators,
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
const value_type*, value_type*>::type
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
pointer;
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
typedef typename std::conditional<__constant_iterators,
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
const value_type&, value_type&>::type
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
reference;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
_Local_iterator() = default;
_Local_iterator(const __hash_code_base& __base,
_Hash_node<_Value, __cache>* __n,
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
std::size_t __bkt, std::size_t __bkt_count)
: __base_type(__base, __n, __bkt, __bkt_count)
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
{ }
reference
operator*() const
hashtable_policy.h: Add C++11 allocator support. 2013-04-22 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h: Add C++11 allocator support. * include/bits/hashtable.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/unordered_map: Likewise. * include/std/unordered_set: Remove bits/algobase.h include. Replace bits/alloc_traits.h by ext/alloc_traits.h. * include/std/unordered_map: Likewise. * include/ext/throw_allocator.h: Add checks on calls to allocator construct/destroy. (std::hash<__gnu_cxx::throw_value_limit>): Add conditional throw. (std::hash<__gnu_cxx::throw_value_random>): Likewise. * testsuite/util/regression/rand/priority_queue /container_rand_regression_test.tcc: Adapt. * testsuite/util/regression/rand/assoc /container_rand_regression_test.tcc: Likewise. * testsuite/util/testsuite_counter_type.h: Add count of destructors. * testsuite/23_containers/unordered_set /not_default_constructible_hash_neg.cc: Adjust dg-error line number. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: New. * testsuite/23_containers/unordered_set/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/minimal.cc: New. * testsuite/23_containers/unordered_set/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_set/allocator/swap.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multiset/allocator/swap.cc: New. * testsuite/23_containers/unordered_map/allocator/copy.cc: New. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/minimal.cc: New. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_map/allocator/swap.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multimap/allocator/swap.cc: New. From-SVN: r198158
2013-04-22 20:22:07 +00:00
{ return this->_M_cur->_M_v(); }
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
pointer
operator->() const
hashtable_policy.h: Add C++11 allocator support. 2013-04-22 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h: Add C++11 allocator support. * include/bits/hashtable.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/unordered_map: Likewise. * include/std/unordered_set: Remove bits/algobase.h include. Replace bits/alloc_traits.h by ext/alloc_traits.h. * include/std/unordered_map: Likewise. * include/ext/throw_allocator.h: Add checks on calls to allocator construct/destroy. (std::hash<__gnu_cxx::throw_value_limit>): Add conditional throw. (std::hash<__gnu_cxx::throw_value_random>): Likewise. * testsuite/util/regression/rand/priority_queue /container_rand_regression_test.tcc: Adapt. * testsuite/util/regression/rand/assoc /container_rand_regression_test.tcc: Likewise. * testsuite/util/testsuite_counter_type.h: Add count of destructors. * testsuite/23_containers/unordered_set /not_default_constructible_hash_neg.cc: Adjust dg-error line number. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: New. * testsuite/23_containers/unordered_set/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/minimal.cc: New. * testsuite/23_containers/unordered_set/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_set/allocator/swap.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multiset/allocator/swap.cc: New. * testsuite/23_containers/unordered_map/allocator/copy.cc: New. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/minimal.cc: New. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_map/allocator/swap.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multimap/allocator/swap.cc: New. From-SVN: r198158
2013-04-22 20:22:07 +00:00
{ return this->_M_cur->_M_valptr(); }
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
_Local_iterator&
operator++()
{
this->_M_incr();
return *this;
}
_Local_iterator
operator++(int)
{
_Local_iterator __tmp(*this);
this->_M_incr();
return __tmp;
}
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/// local const_iterators
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
template<typename _Key, typename _Value, typename _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
bool __constant_iterators, bool __cache>
struct _Local_const_iterator
: public _Local_iterator_base<_Key, _Value, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, __cache>
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
{
private:
using __base_type = _Local_iterator_base<_Key, _Value, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, __cache>;
using __hash_code_base = typename __base_type::__hash_code_base;
public:
typedef _Value value_type;
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
typedef const value_type* pointer;
typedef const value_type& reference;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
_Local_const_iterator() = default;
_Local_const_iterator(const __hash_code_base& __base,
_Hash_node<_Value, __cache>* __n,
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
std::size_t __bkt, std::size_t __bkt_count)
: __base_type(__base, __n, __bkt, __bkt_count)
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
{ }
_Local_const_iterator(const _Local_iterator<_Key, _Value, _ExtractKey,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused,
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
__constant_iterators,
__cache>& __x)
: __base_type(__x)
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
{ }
reference
operator*() const
hashtable_policy.h: Add C++11 allocator support. 2013-04-22 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h: Add C++11 allocator support. * include/bits/hashtable.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/unordered_map: Likewise. * include/std/unordered_set: Remove bits/algobase.h include. Replace bits/alloc_traits.h by ext/alloc_traits.h. * include/std/unordered_map: Likewise. * include/ext/throw_allocator.h: Add checks on calls to allocator construct/destroy. (std::hash<__gnu_cxx::throw_value_limit>): Add conditional throw. (std::hash<__gnu_cxx::throw_value_random>): Likewise. * testsuite/util/regression/rand/priority_queue /container_rand_regression_test.tcc: Adapt. * testsuite/util/regression/rand/assoc /container_rand_regression_test.tcc: Likewise. * testsuite/util/testsuite_counter_type.h: Add count of destructors. * testsuite/23_containers/unordered_set /not_default_constructible_hash_neg.cc: Adjust dg-error line number. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: New. * testsuite/23_containers/unordered_set/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/minimal.cc: New. * testsuite/23_containers/unordered_set/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_set/allocator/swap.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multiset/allocator/swap.cc: New. * testsuite/23_containers/unordered_map/allocator/copy.cc: New. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/minimal.cc: New. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_map/allocator/swap.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multimap/allocator/swap.cc: New. From-SVN: r198158
2013-04-22 20:22:07 +00:00
{ return this->_M_cur->_M_v(); }
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
pointer
operator->() const
hashtable_policy.h: Add C++11 allocator support. 2013-04-22 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h: Add C++11 allocator support. * include/bits/hashtable.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/debug/unordered_set: Likewise. * include/debug/unordered_map: Likewise. * include/std/unordered_set: Remove bits/algobase.h include. Replace bits/alloc_traits.h by ext/alloc_traits.h. * include/std/unordered_map: Likewise. * include/ext/throw_allocator.h: Add checks on calls to allocator construct/destroy. (std::hash<__gnu_cxx::throw_value_limit>): Add conditional throw. (std::hash<__gnu_cxx::throw_value_random>): Likewise. * testsuite/util/regression/rand/priority_queue /container_rand_regression_test.tcc: Adapt. * testsuite/util/regression/rand/assoc /container_rand_regression_test.tcc: Likewise. * testsuite/util/testsuite_counter_type.h: Add count of destructors. * testsuite/23_containers/unordered_set /not_default_constructible_hash_neg.cc: Adjust dg-error line number. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: New. * testsuite/23_containers/unordered_set/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/minimal.cc: New. * testsuite/23_containers/unordered_set/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_set/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_set/allocator/swap.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: New. * testsuite/23_containers/unordered_multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multiset/allocator/swap.cc: New. * testsuite/23_containers/unordered_map/allocator/copy.cc: New. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/minimal.cc: New. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_map/allocator/swap.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: New. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: New. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: New. * testsuite/23_containers/unordered_multimap/allocator/swap.cc: New. From-SVN: r198158
2013-04-22 20:22:07 +00:00
{ return this->_M_cur->_M_valptr(); }
re PR libstdc++/51608 ([C++11] Unordered containers end(size_type) isn't constant time) 2011-12-29 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/51608 * include/bits/hashtable_policy.h (_Equal_helper<>): New, change the way the _Equal functor is used depending on whether hash code is cached or not. (_Ebo_helper<>): New helper type to introduce EBO when possible. (_Hash_code_base): Use _Ebo_helper to limit memory footprint. Move _Equal functor management... (_Hashtable_base): ...here, new, use _Equal_helper. (_Local_iterator_base<>, _Locale_iterator<>, _Locale_const_iterator<>): New, use _Hash_code_base, implementation of... * include/bits/hashtable.h (_Hashtable<>::local_iterator, _Hashtable<>::const_local_iterator): ...those. Add static assertions checking that some functors are empty depending on whether hash code is cache or not. (_Hashtable<>::_M_bucket_index): New overloads using current bucket count, use through out the _Hastable<> implementation. * include/bits/unordered_set.h (__unordered_set<>, __unordered_multiset<>): Cache hash code iff hash functor is not empty and not final. * include/bits/unordered_map.h (__unordered_map<>, __unordered_multimap<>): Likewise. * include/debug/unordered_map (unordered_map<>::_S_to_local, unordered_multimap<>::_S_to_local): Adapt to match new local iterator implementation. * include/debug/unordered_set (unordered_set<>::_S_to_local, unordered_multiset<>::_S_to_local): Likewise. * include/profile/unordered_map (unordered_map<>::_M_profile_destruct, unordered_multimap<>::_M_profile_destruct): Enhance thanks to usage of local iterators. * include/profile/unordered_set (unordered_set<>::_M_profile_destruct, unordered_multiset<>::_M_profile_destruct): Likewise. * testsuite_files/23_containers/unordered_set/instantiation_neg.cc: Fix error line. * testsuite_files/23_containers/unordered_set/final_hash.cc: New. * testsuite_files/23_containers/unordered_multiset/final_hash.cc: New. * testsuite_files/23_containers/unordered_map/final_hash.cc: New. * testsuite_files/23_containers/unordered_multimap/final_hash.cc: New. From-SVN: r182727
2011-12-29 17:58:51 +00:00
_Local_const_iterator&
operator++()
{
this->_M_incr();
return *this;
}
_Local_const_iterator
operator++(int)
{
_Local_const_iterator __tmp(*this);
this->_M_incr();
return __tmp;
}
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/**
* Primary class template _Hashtable_base.
*
* Helper class adding management of _Equal functor to
* _Hash_code_base type.
*
* Base class templates are:
* - __detail::_Hash_code_base
* - __detail::_Hashtable_ebo_helper
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
*/
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
template<typename _Key, typename _Value, typename _ExtractKey,
typename _Equal, typename _Hash, typename _RangeHash,
typename _Unused, typename _Traits>
struct _Hashtable_base
: public _Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash,
_Unused, _Traits::__hash_cached::value>,
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
private _Hashtable_ebo_helper<0, _Equal>
{
public:
typedef _Key key_type;
typedef _Value value_type;
typedef _Equal key_equal;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
using __traits_type = _Traits;
using __hash_cached = typename __traits_type::__hash_cached;
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
using __hash_code_base = _Hash_code_base<_Key, _Value, _ExtractKey,
_Hash, _RangeHash, _Unused,
__hash_cached::value>;
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
using __hash_code = typename __hash_code_base::__hash_code;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
private:
using _EqualEBO = _Hashtable_ebo_helper<0, _Equal>;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
static bool
_S_equals(__hash_code, const _Hash_node_code_cache<false>&)
{ return true; }
static bool
_S_node_equals(const _Hash_node_code_cache<false>&,
const _Hash_node_code_cache<false>&)
{ return true; }
static bool
_S_equals(__hash_code __c, const _Hash_node_code_cache<true>& __n)
{ return __c == __n._M_hash_code; }
static bool
_S_node_equals(const _Hash_node_code_cache<true>& __lhn,
const _Hash_node_code_cache<true>& __rhn)
{ return __lhn._M_hash_code == __rhn._M_hash_code; }
protected:
_Hashtable_base() = default;
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_Hashtable_base(const _Hash& __hash, const _Equal& __eq)
: __hash_code_base(__hash), _EqualEBO(__eq)
{ }
bool
_M_equals(const _Key& __k, __hash_code __c,
const _Hash_node_value<_Value, __hash_cached::value>& __n) const
{
static_assert(__is_invocable<const _Equal&, const _Key&, const _Key&>{},
PR libstdc++/85965 move is_invocable assertions again This is another attempt to reduce how often the assertions are evaluated, so that code which doesn't try to use the function objects doesn't need them to be invocable. For _Rb_tree we access the _M_key_compare object directly, so can't put the assertions in an accessor function for it. However, every invocation of _M_key_compare is accompanied by a use of _S_key, so the assertions can be put in there. For _Hashtable there are member functions that are consistently used to obtain a hash code or test for equality, so the assertions can go in those members. PR libstdc++/85965 * include/bits/hashtable.h (_Hashtable::~_Hashtable()): Remove static assertions from the destructor. * include/bits/hashtable_policy.h (_Hash_code_base::_M_hash_code): Move static_assert for hash function to here. (_Hash_table_base::_M_equals): Move static_assert for equality predicate to here. * include/bits/stl_tree.h (_Rb_tree::_S_value(_Const_Link_type)): Remove. (_Rb_tree::_S_key(_Const_Link_type)): Move assertions here. Access the value directly instead of calling _S_value. (_Rb_tree::_S_value(_Const_Base_ptr)): Remove. (_Rb_tree::_S_key(_Const_Base_ptr)): Do downcast and forward to _S_key(_Const_Link_type). * testsuite/23_containers/set/85965.cc: Check construction, destruction, assignment and size() do not trigger the assertions. * testsuite/23_containers/unordered_set/85965.cc: Likewise. * testsuite/23_containers/map/48101_neg.cc: Call find and adjust expected errors. * testsuite/23_containers/multimap/48101_neg.cc: Likewise. * testsuite/23_containers/multiset/48101_neg.cc: Likewise. * testsuite/23_containers/set/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_map/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_set/48101_neg.cc: Likewise. From-SVN: r271323
2019-05-17 15:13:32 +01:00
"key equality predicate must be invocable with two arguments of "
"key type");
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
return _S_equals(__c, __n) && _M_eq()(__k, _ExtractKey{}(__n._M_v()));
}
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
libstdc++: Add unordered containers heterogeneous lookup Add unordered containers heterogeneous lookup member functions find, count, contains and equal_range in C++20. Those members are considered for overload resolution only if hash and equal functors used to instantiate the container have a nested is_transparent type. libstdc++-v3/ChangeLog: * include/bits/stl_tree.h (__has_is_transparent, __has_is_transparent_t): Move... * include/bits/stl_function.h: ...here. * include/bits/hashtable_policy.h (_Hash_code_base<>::_M_hash_code_tr): New.. (_Hashtable_base<>::_M_equals_tr): New. * include/bits/hashtable.h (_Hashtable<>::_M_find_tr, _Hashtable<>::_M_count_tr, _Hashtable<>::_M_equal_range_tr): New member function templates to perform heterogeneous lookup. (_Hashtable<>::_M_find_before_node_tr): New. (_Hashtable<>::_M_find_node_tr): New. * include/bits/unordered_map.h (unordered_map::find<>, unordered_map::count<>, unordered_map::contains<>, unordered_map::equal_range<>): New member function templates to perform heterogeneous lookup. (unordered_multimap::find<>, unordered_multimap::count<>, unordered_multimap::contains<>, unordered_multimap::equal_range<>): Likewise. * include/bits/unordered_set.h (unordered_set::find<>, unordered_set::count<>, unordered_set::contains<>, unordered_set::equal_range<>): Likewise. (unordered_multiset::find<>, unordered_multiset::count<>, unordered_multiset::contains<>, unordered_multiset::equal_range<>): Likewise. * include/debug/unordered_map (unordered_map::find<>, unordered_map::equal_range<>): Likewise. (unordered_multimap::find<>, unordered_multimap::equal_range<>): Likewise. * include/debug/unordered_set (unordered_set::find<>, unordered_set::equal_range<>): Likewise. (unordered_multiset::find<>, unordered_multiset::equal_range<>): Likewise. * testsuite/23_containers/unordered_map/operations/1.cc: New test. * testsuite/23_containers/unordered_multimap/operations/1.cc: New test. * testsuite/23_containers/unordered_multiset/operations/1.cc: New test. * testsuite/23_containers/unordered_set/operations/1.cc: New test.
2020-11-30 20:57:16 +01:00
template<typename _Kt>
bool
_M_equals_tr(const _Kt& __k, __hash_code __c,
const _Hash_node_value<_Value,
__hash_cached::value>& __n) const
{
static_assert(
__is_invocable<const _Equal&, const _Kt&, const _Key&>{},
"key equality predicate must be invocable with two arguments of "
"key type");
return _S_equals(__c, __n) && _M_eq()(__k, _ExtractKey{}(__n._M_v()));
}
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
bool
_M_node_equals(
const _Hash_node_value<_Value, __hash_cached::value>& __lhn,
const _Hash_node_value<_Value, __hash_cached::value>& __rhn) const
{
return _S_node_equals(__lhn, __rhn)
&& _M_eq()(_ExtractKey{}(__lhn._M_v()), _ExtractKey{}(__rhn._M_v()));
}
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
void
_M_swap(_Hashtable_base& __x)
{
__hash_code_base::_M_swap(__x);
std::swap(_EqualEBO::_M_get(), __x._EqualEBO::_M_get());
}
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
const _Equal&
_M_eq() const { return _EqualEBO::_M_cget(); }
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
/**
* Primary class template _Equality.
*
* This is for implementing equality comparison for unordered
* containers, per N3068, by John Lakos and Pablo Halpern.
* Algorithmically, we follow closely the reference implementations
* therein.
*/
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits,
bool _Unique_keys = _Traits::__unique_keys::value>
struct _Equality;
/// unordered_map and unordered_set specializations.
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
struct _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, true>
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
{
using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused,
_RehashPolicy, _Traits>;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
bool
_M_equal(const __hashtable&) const;
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
bool
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
_Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, true>::
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
_M_equal(const __hashtable& __other) const
{
using __node_type = typename __hashtable::__node_type;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
const __hashtable* __this = static_cast<const __hashtable*>(this);
if (__this->size() != __other.size())
return false;
for (auto __itx = __this->begin(); __itx != __this->end(); ++__itx)
{
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
std::size_t __ybkt = __other._M_bucket_index(*__itx._M_cur);
auto __prev_n = __other._M_buckets[__ybkt];
if (!__prev_n)
return false;
for (__node_type* __n = static_cast<__node_type*>(__prev_n->_M_nxt);;
__n = __n->_M_next())
{
if (__n->_M_v() == *__itx)
break;
if (!__n->_M_nxt
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
|| __other._M_bucket_index(*__n->_M_next()) != __ybkt)
return false;
}
}
return true;
}
/// unordered_multiset and unordered_multimap specializations.
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
struct _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, false>
{
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused,
_RehashPolicy, _Traits>;
bool
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
_M_equal(const __hashtable&) const;
};
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
template<typename _Key, typename _Value, typename _Alloc,
typename _ExtractKey, typename _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
typename _Hash, typename _RangeHash, typename _Unused,
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
typename _RehashPolicy, typename _Traits>
bool
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
_Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal,
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, false>::
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
_M_equal(const __hashtable& __other) const
{
using __node_type = typename __hashtable::__node_type;
unordered_map.h (__unordered_map): Remove. 2012-04-12 Benjamin Kosnik <bkoz@redhat.com> * include/bits/unordered_map.h (__unordered_map): Remove. (__unordered_multimap): Remove. Add aliases for __umap_traits, __umap_hashtable, __ummap_traits, __ummap_hashtable. (unordered_map): Derive from __umap_hashtable. (unordered_multimap): Derive from __ummap_hashtable. * include/bits/unordered_set.h (__unordered_set): Remove. (__unordered_multiset): Remove. Add aliases for __uset_traits, __uset_hashtable, __umset_traits, __umset_hashtable. (unordered_set): Derive from __uset_hashtable. (unordered_multiset): Derive from __umset_hashtable. * include/bits/hashtable.h (__cache_default): New, consolidated cache defaults for _Hashtable. Adjust comments for doxygen. (_Hashtable): Consolidate bool template parameters into new, _Traits class. Inherited base classes synthesize _Hashtable in CRTP via original 10 parameters. Prefer using declarations to typedefs, add __node_type, __bucket_type, etc. Push many nested types down hierarchy to _Hashtable_base. Add constructors necessary for top-level unordered_containers. Consolidate insert member functions and logic in new base class, __detail::_Insert and __detail::_Insert_base. (_Hashtable::operator=(initializer_list)): Add. * include/bits/hashtable_policy.h: Convert to doxygen markup. (_Hashtable_traits) New. Consolidate bool template parameters here. (_Insert, _Insert_base): New, consolidated insert member functions. (_Map_base, _Equality, _Rehash_base): Adjust template parameters, use base types. (_Hashtable_base): Move type declarations useful to other base classes into this class. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust traits, line numbers. From-SVN: r186403
2012-04-13 00:33:10 +00:00
const __hashtable* __this = static_cast<const __hashtable*>(this);
if (__this->size() != __other.size())
return false;
for (auto __itx = __this->begin(); __itx != __this->end();)
{
std::size_t __x_count = 1;
auto __itx_end = __itx;
for (++__itx_end; __itx_end != __this->end()
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
&& __this->key_eq()(_ExtractKey{}(*__itx),
_ExtractKey{}(*__itx_end));
++__itx_end)
++__x_count;
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
std::size_t __ybkt = __other._M_bucket_index(*__itx._M_cur);
auto __y_prev_n = __other._M_buckets[__ybkt];
if (!__y_prev_n)
return false;
__node_type* __y_n = static_cast<__node_type*>(__y_prev_n->_M_nxt);
for (;;)
{
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters Limit our _Hashtable implementation to ranged hash. _H1 is now rename to _Hash matching the _Hash functor used for unordered containers. _H2 is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove _ExtractKey storage. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash _H2 into _RangeHash and _Hash into _Unused. (_Hastable_base<>): Likewise. (_Map_base<>): Likewise. (_Insert_base<>): Likewise. (_Insert<>): Likewise. (_Rehash_base<>): Likewise. (_Local_iterator_base<>): Likewise. (_Hash_code_base<>): Likewise. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>): Remove. (_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused, bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type.. (_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this. (_Local_iterator<>): Remove _H1 and _H2 template parameters. (_Local_const_iterator<>): Likewise. (_Equality<>): Likewise. (_Map_base<>::operator[](const key_type&): Adapt. (_Map_base<>::operator[](key_type&&): Adapt. (_Identity::operator()): Add noexcept. (_Select1st::operator()): Likewise. (_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base type. (_Hash_code_base::_M_extract): Remove. * include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template parameters. Remove _ExtractKey from constructors. (_Hashtable<>::_M_insert_unique_node(const key_type&, size_t, __hash_code, __node_type*, size_t)): Replace by... (_Hashtable<>::_M_insert_unique_node(size_t, __hash_code, __node_type*, size_t)): ...this. (_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&, __hash_code, __node_type*)): Replace by... (_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code, __node_type*)): ...this. (_Hashtable<>::__key_extract): Remove. * include/bits/node_handle.h: Adapt.
2020-01-20 08:21:10 +01:00
if (__this->key_eq()(_ExtractKey{}(__y_n->_M_v()),
_ExtractKey{}(*__itx)))
break;
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
auto __y_ref_n = __y_n;
for (__y_n = __y_n->_M_next(); __y_n; __y_n = __y_n->_M_next())
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
if (!__other._M_node_equals(*__y_ref_n, *__y_n))
break;
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
if (!__y_n || __other._M_bucket_index(*__y_n) != __ybkt)
return false;
}
typename __hashtable::const_iterator __ity(__y_n);
for (auto __ity_end = __ity; __ity_end != __other.end(); ++__ity_end)
if (--__x_count == 0)
break;
if (__x_count != 0)
return false;
if (!std::is_permutation(__itx, __itx_end, __ity))
return false;
__itx = __itx_end;
}
return true;
}
re PR libstdc++/36104 (gnu-versioned-namespace is broken) 2011-01-14 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/36104 * include/Makefile.am (bits_sup_headers, stamp-bits-sup): New. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am (std_HEADERS, bits_HEADERS): New. (install-stdHEADERS, install-bitsHEADERS): New. * libsupc++/Makefile.in: Regenerate. * include/bits/c++config: Update for inline namespaces. * libsupc++/cxxabi-forced.h: To... * libsupc++/cxxabi_forced.h: ...this. * libsupc++/hash_bytes.h: Separate file. * libsupc++/typeinfo: Use it. * libsupc++/exception: Adjust for bits subdirectory. * libsupc++/eh_aux_runtime.cc: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/new_op.cc: Same. * libsupc++/exception_defines.h: Same. * libsupc++/nested_exception.h: Same. * libsupc++/eh_terminate.cc: Same. * libsupc++/vec.cc: Same. * libsupc++/vterminate.cc: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/eh_personality.cc: Same. * libsupc++/eh_call.cc: Same. * libsupc++/new_opnt.cc: Same. * libsupc++/hash_bytes.cc: Same. * config/cpu/arm/cxxabi_tweaks.h: Same. * config/cpu/generic/cxxabi_tweaks.h: Same. * libsupc++/cxxabi.h: Same. Consolidate _GLIBCXX_NOTHROW defines. * include/std/bitset: Same. * include/ext/vstring.tcc: Same. * include/bits/hashtable.h: Same. * include/bits/functional_hash.h: Same. * include/bits/hashtable_policy.h: Same. * include/bits/basic_string.h: Same. * include/bits/istream.tcc: Same. * include/bits/ostream.tcc: Same. * include/bits/algorithmfwd.h: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/fstream.tcc: Same. * include/bits/functexcept.h: Same. * doc/doxygen/user.cfg.in: Adjust names. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. From-SVN: r168831
2011-01-15 00:27:10 +00:00
/**
2019-06-17 10:25:04 +00:00
* This type deals with all allocation and keeps an allocator instance
* through inheritance to benefit from EBO when possible.
*/
template<typename _NodeAlloc>
struct _Hashtable_alloc : private _Hashtable_ebo_helper<0, _NodeAlloc>
{
private:
using __ebo_node_alloc = _Hashtable_ebo_helper<0, _NodeAlloc>;
public:
using __node_type = typename _NodeAlloc::value_type;
using __node_alloc_type = _NodeAlloc;
// Use __gnu_cxx to benefit from _S_always_equal and al.
using __node_alloc_traits = __gnu_cxx::__alloc_traits<__node_alloc_type>;
using __value_alloc_traits = typename __node_alloc_traits::template
rebind_traits<typename __node_type::value_type>;
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
using __node_ptr = __node_type*;
using __node_base = _Hash_node_base;
using __node_base_ptr = __node_base*;
using __buckets_alloc_type =
__alloc_rebind<__node_alloc_type, __node_base_ptr>;
using __buckets_alloc_traits = std::allocator_traits<__buckets_alloc_type>;
using __buckets_ptr = __node_base_ptr*;
_Hashtable_alloc() = default;
_Hashtable_alloc(const _Hashtable_alloc&) = default;
_Hashtable_alloc(_Hashtable_alloc&&) = default;
template<typename _Alloc>
_Hashtable_alloc(_Alloc&& __a)
: __ebo_node_alloc(std::forward<_Alloc>(__a))
{ }
__node_alloc_type&
_M_node_allocator()
{ return __ebo_node_alloc::_M_get(); }
const __node_alloc_type&
_M_node_allocator() const
{ return __ebo_node_alloc::_M_cget(); }
2019-06-17 10:25:04 +00:00
// Allocate a node and construct an element within it.
template<typename... _Args>
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
__node_ptr
_M_allocate_node(_Args&&... __args);
2019-06-17 10:25:04 +00:00
// Destroy the element within a node and deallocate the node.
void
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_M_deallocate_node(__node_ptr __n);
2019-06-17 10:25:04 +00:00
// Deallocate a node.
void
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_M_deallocate_node_ptr(__node_ptr __n);
2019-06-17 10:25:04 +00:00
// Deallocate the linked list of nodes pointed to by __n.
// The elements within the nodes are destroyed.
void
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_M_deallocate_nodes(__node_ptr __n);
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
__buckets_ptr
_M_allocate_buckets(std::size_t __bkt_count);
void
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_M_deallocate_buckets(__buckets_ptr, std::size_t __bkt_count);
};
// Definitions of class template _Hashtable_alloc's out-of-line member
// functions.
template<typename _NodeAlloc>
template<typename... _Args>
auto
_Hashtable_alloc<_NodeAlloc>::_M_allocate_node(_Args&&... __args)
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
-> __node_ptr
{
auto __nptr = __node_alloc_traits::allocate(_M_node_allocator(), 1);
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
__node_ptr __n = std::__to_address(__nptr);
__try
{
stl_map.h (map): Implement C++11 allocator-aware container requirements. * include/bits/stl_map.h (map): Implement C++11 allocator-aware container requirements. * include/bits/stl_multimap.h (multimap): Likewise. * include/bits/stl_multiset.h (multiset): Likewise. * include/bits/stl_set.h (set): Likewise. * include/bits/stl_tree.h (_Rb_tree_node): Use __aligned_buffer and add accessors for value. (_Rb_tree_iterator, _Rb_tree_const_iterator): Use _Rb_tree_node accessors. (_Rb_tree): Use allocator_traits and implement support for sets and maps the be allocator-aware. * include/bits/forward_list.h (_Fwd_list_base::_M_create_node): Do not zero-initialize storage buffer. * include/bits/hashtable_policy.h (_Hashtable_alloc::_M_allocate_node): Likewise. * include/bits/stl_vector.h (vector(vector&&, const allocator_type&)): Add conditional noexcept specification. * doc/xml/manual/status_cxx2011.xml: Update status of containers. * testsuite/util/testsuite_allocator.h: Re-indent. * testsuite/23_containers/forward_list/allocator/copy.cc: Test allocator-extended copy constructor. * testsuite/23_containers/unordered_map/allocator/copy.cc: Likewise. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: Likewise. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: Likewise. * testsuite/23_containers/vector/allocator/copy.cc: Likewise. * testsuite/23_containers/forward_list/allocator/move.cc: New. * testsuite/23_containers/unordered_map/allocator/move.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move.cc: New. * testsuite/23_containers/unordered_set/allocator/move.cc: New. * testsuite/23_containers/vector/allocator/move.cc: New. * testsuite/23_containers/map/allocator/copy.cc: New. * testsuite/23_containers/map/allocator/copy_assign.cc: New. * testsuite/23_containers/map/allocator/minimal.cc: New. * testsuite/23_containers/map/allocator/move.cc: New. * testsuite/23_containers/map/allocator/move_assign.cc: New. * testsuite/23_containers/map/allocator/noexcept.cc: New. * testsuite/23_containers/map/allocator/swap.cc: New. * testsuite/23_containers/multimap/allocator/copy.cc: New. * testsuite/23_containers/multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/multimap/allocator/minimal.cc: New. * testsuite/23_containers/multimap/allocator/move.cc: New. * testsuite/23_containers/multimap/allocator/move_assign.cc: New. * testsuite/23_containers/multimap/allocator/noexcept.cc: New. * testsuite/23_containers/multimap/allocator/swap.cc: New. * testsuite/23_containers/multiset/allocator/copy.cc: New. * testsuite/23_containers/multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/multiset/allocator/minimal.cc: New. * testsuite/23_containers/multiset/allocator/move.cc: New. * testsuite/23_containers/multiset/allocator/move_assign.cc: New. * testsuite/23_containers/multiset/allocator/noexcept.cc: New. * testsuite/23_containers/multiset/allocator/swap.cc: New. * testsuite/23_containers/set/allocator/copy.cc: New. * testsuite/23_containers/set/allocator/copy_assign.cc: New. * testsuite/23_containers/set/allocator/minimal.cc: New. * testsuite/23_containers/set/allocator/move.cc: New. * testsuite/23_containers/set/allocator/move_assign.cc: New. * testsuite/23_containers/set/allocator/noexcept.cc: New. * testsuite/23_containers/set/allocator/swap.cc: New. * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Adjust dg-error line number. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Likewise. From-SVN: r204848
2013-11-15 15:34:14 +00:00
::new ((void*)__n) __node_type;
__node_alloc_traits::construct(_M_node_allocator(),
__n->_M_valptr(),
std::forward<_Args>(__args)...);
return __n;
}
__catch(...)
{
__node_alloc_traits::deallocate(_M_node_allocator(), __nptr, 1);
__throw_exception_again;
}
}
template<typename _NodeAlloc>
void
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_Hashtable_alloc<_NodeAlloc>::_M_deallocate_node(__node_ptr __n)
{
__node_alloc_traits::destroy(_M_node_allocator(), __n->_M_valptr());
_M_deallocate_node_ptr(__n);
}
template<typename _NodeAlloc>
void
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_Hashtable_alloc<_NodeAlloc>::_M_deallocate_node_ptr(__node_ptr __n)
{
typedef typename __node_alloc_traits::pointer _Ptr;
auto __ptr = std::pointer_traits<_Ptr>::pointer_to(*__n);
__n->~__node_type();
__node_alloc_traits::deallocate(_M_node_allocator(), __ptr, 1);
}
template<typename _NodeAlloc>
void
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_Hashtable_alloc<_NodeAlloc>::_M_deallocate_nodes(__node_ptr __n)
{
while (__n)
{
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
__node_ptr __tmp = __n;
__n = __n->_M_next();
_M_deallocate_node(__tmp);
}
}
template<typename _NodeAlloc>
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
auto
_Hashtable_alloc<_NodeAlloc>::_M_allocate_buckets(std::size_t __bkt_count)
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
-> __buckets_ptr
{
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
__buckets_alloc_type __alloc(_M_node_allocator());
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
auto __ptr = __buckets_alloc_traits::allocate(__alloc, __bkt_count);
__buckets_ptr __p = std::__to_address(__ptr);
__builtin_memset(__p, 0, __bkt_count * sizeof(__node_base_ptr));
return __p;
}
template<typename _NodeAlloc>
void
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
_Hashtable_alloc<_NodeAlloc>::
_M_deallocate_buckets(__buckets_ptr __bkts,
std::size_t __bkt_count)
{
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
typedef typename __buckets_alloc_traits::pointer _Ptr;
auto __ptr = std::pointer_traits<_Ptr>::pointer_to(*__bkts);
libstdc++: Refactor _Hashtable to prepare for custom pointers Limit usage of node pointers in _Hashtable implementation details so that when we move to allocator custom pointer type we do not need to add an _Alloc template parameter everywhere which would impact abi. This is done by reviewing node type definition. It is now based on new basic types which are not pointer dependant. The _Hashtable helper types are now using those new node base types and do not receive node pointers. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_node_value_base<>): Remove _Hash_node_base inheritance. (_Hash_node_code_cache<bool _Cache_hash_code>): New. (_Hash_node_value<typename _Value, bool _Cache_hash_code>): New. (_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>. (_Map_base<>::__node_type): Remove. (_Map_base<>::iterator): Remove. (_Insert_base<>::__hash_cached): New. (_Insert_base<>::__constant_iterators): New. (_Insert_base<>::__hashtable_alloc): New. (_Insert_base<>::__node_type): Remove. (_Insert_base<>::__node_ptr): New. (_Hash_code_base<>): Remove specializations. (_Hash_code_base<>::__node_type): Remove. (_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)): Replace by... (_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)): ...this. (_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)): Replace by... (_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)): ...this. (_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)): Replace by... (_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&, const _Hash_node_code_base<>&)): ...this. (_Hashtable_base<>::__constant_iterators): Remove. (_Hashtable_base<>::__unique_keys): Remove. (_Hashtable_base<>::__node_type): Remove. (_Hashtable_base<>::iterator): Remove. (_Hashtable_base<>::const_iterator): Remove. (_Hashtable_base<>::local_iterator): Remove. (_Hashtable_base<>::const_local_iterator): Remove. (_Hashtable_base<>::__ireturn_type): Remove. (_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by... (_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by... (_Hashtable_base<>::_S_node_equals(__hash_code, const _Hash_node_code_hash<>&)): ...this. (_Hashtable_base<>::_Equal_hash_code<>): Remove. (_Hashtable_base<>::_M_equals): Adapt. (_Hashtable_baxe<>::_M_node_equals): Adapt. (_Equality<>::_M_equal): Adapt. (_Hashtable_alloc<>::__node_ptr): New. (_Hashtable_alloc<>::__bucket_type): Rename into... (_Hashtable_alloc<>::__node_base_ptr): ...this. (_Hashtable_alloc<>::__bucket_alloc_type): Rename into... (_Hashtable_alloc<>::__buckets_alloc_type): ...this. (_Hashtable_alloc<>::__bucket_alloc_traits): Rename into... (_Hashtable_alloc<>::__buckets_alloc_traits): ...this. (_Hashtable_alloc<>::__buckets_ptr): New. (_Hashtable_alloc<>::_M_allocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node): Adapt. (_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt. (_Hashtable_alloc<>::_M_deallocate_nodes): Adapt. (_Hashtable_alloc<>::_M_allocate_buckets): Adapt. (_Hashtable_alloc<>::_M_deallocate_buckets): Adapt. * include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-04 18:06:11 +02:00
__buckets_alloc_type __alloc(_M_node_allocator());
__buckets_alloc_traits::deallocate(__alloc, __ptr, __bkt_count);
}
libstdc++: Fix doxygen markup for group close commands A change in Doxygen 1.8.16 means that "// @}" is no longer recognized by Doxygen, so doesn't close a @{ group. A "///" comment needs to be used. libstdc++-v3/ChangeLog: * include/bits/atomic_base.h: Fix doxygen group close. * include/bits/basic_ios.h: Likewise. * include/bits/forward_list.h: Likewise. * include/bits/fs_dir.h: Likewise. * include/bits/fs_ops.h: Likewise. * include/bits/fs_path.h: Likewise. * include/bits/functional_hash.h: Likewise. * include/bits/gslice.h: Likewise. * include/bits/gslice_array.h: Likewise. * include/bits/hashtable_policy.h: Likewise. * include/bits/indirect_array.h: Likewise. * include/bits/locale_classes.h: Likewise. * include/bits/locale_facets.h: Likewise. * include/bits/locale_facets_nonio.h: Likewise. * include/bits/mask_array.h: Likewise. * include/bits/refwrap.h: Likewise. * include/bits/regex.h: Likewise. * include/bits/regex_automaton.h: Likewise. * include/bits/regex_compiler.h: Likewise. * include/bits/regex_constants.h: Likewise. * include/bits/regex_error.h: Likewise. * include/bits/regex_executor.h: Likewise. * include/bits/regex_scanner.h: Likewise. * include/bits/shared_ptr.h: Likewise. * include/bits/shared_ptr_atomic.h: Likewise. * include/bits/shared_ptr_base.h: Likewise. * include/bits/slice_array.h: Likewise. * include/bits/specfun.h: Likewise. * include/bits/std_function.h: Likewise. * include/bits/std_mutex.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_iterator.h: Likewise. * include/bits/stl_iterator_base_types.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_numeric.h: Likewise. * include/bits/stl_pair.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_uninitialized.h: Likewise. * include/bits/stream_iterator.h: Likewise. * include/bits/streambuf_iterator.h: Likewise. * include/bits/unique_ptr.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/decimal/decimal: Likewise. * include/experimental/any: Likewise. * include/experimental/array: Likewise. * include/experimental/bits/fs_dir.h: Likewise. * include/experimental/bits/fs_fwd.h: Likewise. * include/experimental/bits/fs_ops.h: Likewise. * include/experimental/bits/fs_path.h: Likewise. * include/experimental/buffer: Likewise. * include/experimental/internet: Likewise. * include/experimental/optional: Likewise. * include/experimental/propagate_const: Likewise. * include/experimental/socket: Likewise. * include/ext/pb_ds/assoc_container.hpp: Likewise. * include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp: Likewise. * include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp: Likewise. * include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp: Likewise. * include/ext/pb_ds/detail/types_traits.hpp: Likewise. * include/ext/pb_ds/exception.hpp: Likewise. * include/ext/pb_ds/priority_queue.hpp: Likewise. * include/ext/pb_ds/tag_and_trait.hpp: Likewise. * include/ext/random: Likewise. * include/std/any: Likewise. * include/std/atomic: Likewise. * include/std/bitset: Likewise. * include/std/chrono: Likewise. * include/std/complex: Likewise. * include/std/condition_variable: Likewise. * include/std/fstream: Likewise. * include/std/future: Likewise. * include/std/iostream: Likewise. * include/std/istream: Likewise. * include/std/mutex: Likewise. * include/std/numeric: Likewise. * include/std/ostream: Likewise. * include/std/ratio: Likewise. * include/std/shared_mutex: Likewise. * include/std/stdexcept: Likewise. * include/std/streambuf: Likewise. * include/std/system_error: Likewise. * include/std/thread: Likewise. * include/std/valarray: Likewise. * include/std/variant: Likewise. * include/tr1/cmath: Likewise. * include/tr1/regex: Likewise. * include/tr2/dynamic_bitset: Likewise. * libsupc++/atomic_lockfree_defines.h: Likewise. * libsupc++/exception: Likewise. * libsupc++/exception.h: Likewise. * libsupc++/exception_ptr.h: Likewise. * libsupc++/nested_exception.h: Likewise. libstdc++-v3/ChangeLog: * include/tr1/regex:
2021-04-06 15:52:19 +01:00
///@} hashtable-detail
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 22:39:36 +00:00
} // namespace __detail
re PR libstdc++/81064 (Inline namespace regression) 2017-07-23 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/81064 * include/bits/algorithmfwd.h: Reorganize versioned namespace. * include/bits/basic_string.h: Likewise. * include/bits/c++config: Likewise. * include/bits/deque.tcc: Likewise. * include/bits/forward_list.h: Likewise. * include/bits/forward_list.tcc: Likewise. * include/bits/hashtable_policy.h: Likewise. * include/bits/list.tcc: Likewise. * include/bits/move.h: Likewise. * include/bits/quoted_string.h: Likewise. * include/bits/random.h: Likewise. * include/bits/random.tcc: Likewise. * include/bits/regex.h: Likewise. * include/bits/regex.tcc: Likewise. * include/bits/regex_automaton.h: Likewise. * include/bits/regex_automaton.tcc: Likewise. * include/bits/regex_compiler.h: Likewise. * include/bits/regex_compiler.tcc: Likewise. * include/bits/regex_constants.h: Likewise. * include/bits/regex_error.h: Likewise. * include/bits/regex_executor.h: Likewise. * include/bits/regex_executor.tcc: Likewise. * include/bits/regex_scanner.h: Likewise. * include/bits/regex_scanner.tcc: Likewise. * include/bits/specfun.h: Likewise. * include/bits/stl_algo.h: Likewise. * include/bits/stl_algobase.h: Likewise. * include/bits/stl_bvector.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_iterator.h: Likewise. * include/bits/stl_iterator_base_funcs.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_relops.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/uniform_int_dist.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/vector.tcc: Likewise. * include/c_global/cmath: Likewise. * include/c_std/cmath: Likewise. * include/decimal/decimal: Likewise. * include/decimal/decimal.h: Likewise. * include/experimental/algorithm: Likewise. * include/experimental/any: Likewise. * include/experimental/array: Likewise. * include/experimental/bits/erase_if.h: Likewise. * include/experimental/bits/fs_dir.h: Likewise. * include/experimental/bits/fs_fwd.h: Likewise. * include/experimental/bits/fs_ops.h: Likewise. * include/experimental/bits/fs_path.h: Likewise. * include/experimental/bits/lfts_config.h: Likewise. * include/experimental/bits/shared_ptr.h: Likewise. * include/experimental/bits/string_view.tcc: Likewise. * include/experimental/chrono: Likewise. * include/experimental/deque: Likewise. * include/experimental/filesystem: Likewise. * include/experimental/forward_list: Likewise. * include/experimental/functional: Likewise. * include/experimental/iterator: Likewise. * include/experimental/list: Likewise. * include/experimental/map: Likewise. * include/experimental/memory: Likewise. * include/experimental/memory_resource: Likewise. * include/experimental/numeric: Likewise. * include/experimental/optional: Likewise. * include/experimental/propagate_const: Likewise. * include/experimental/random: Likewise. * include/experimental/ratio: Likewise. * include/experimental/regex: Likewise. * include/experimental/set: Likewise. * include/experimental/source_location: Likewise. * include/experimental/string: Likewise. * include/experimental/string_view: Likewise. * include/experimental/system_error: Likewise. * include/experimental/tuple: Likewise. * include/experimental/type_traits: Likewise. * include/experimental/unordered_map: Likewise. * include/experimental/unordered_set: Likewise. * include/experimental/utility: Likewise. * include/experimental/vector: Likewise. * include/ext/bitmap_allocator.h: Likewise. * include/ext/codecvt_specializations.h: Likewise. * include/ext/rope: Likewise. * include/ext/typelist.h: Likewise. * include/std/chrono: Likewise. * include/std/complex: Likewise. * include/std/functional: Likewise. * include/std/numeric: Likewise. * include/std/string_view: Likewise. * include/std/thread: Likewise. * include/std/variant: Likewise. * include/tr1/array: Likewise. * include/tr1/bessel_function.tcc: Likewise. * include/tr1/beta_function.tcc: Likewise. * include/tr1/cmath: Likewise. * include/tr1/complex: Likewise. * include/tr1/ell_integral.tcc: Likewise. * include/tr1/exp_integral.tcc: Likewise. * include/tr1/functional: Likewise. * include/tr1/functional_hash.h: Likewise. * include/tr1/gamma.tcc: Likewise. * include/tr1/hashtable.h: Likewise. * include/tr1/hashtable_policy.h: Likewise. * include/tr1/hypergeometric.tcc: Likewise. * include/tr1/legendre_function.tcc: Likewise. * include/tr1/modified_bessel_func.tcc: Likewise. * include/tr1/poly_hermite.tcc: Likewise. * include/tr1/poly_laguerre.tcc: Likewise. * include/tr1/random.h: Likewise. * include/tr1/random.tcc: Likewise. * include/tr1/regex: Likewise. * include/tr1/riemann_zeta.tcc: Likewise. * include/tr1/shared_ptr.h: Likewise. * include/tr1/special_function_util.h: Likewise. * include/tr1/tuple: Likewise. * include/tr1/type_traits: Likewise. * include/tr1/unordered_map.h: Likewise. * include/tr1/unordered_set.h: Likewise. * include/tr1/utility: Likewise. * include/tr2/bool_set: Likewise. * include/tr2/bool_set.tcc: Likewise. * include/tr2/dynamic_bitset: Likewise. * include/tr2/dynamic_bitset.tcc: Likewise. * include/tr2/ratio: Likewise. * include/tr2/type_traits: Likewise. * src/c++11/chrono.cc: Likewise. * src/c++11/compatibility-c++0x.cc: Likewise. * src/c++11/compatibility-chrono.cc: Likewise. * src/c++11/cxx11-shim_facets.cc: Likewise. * src/c++11/hashtable_c++0x.cc: Likewise. * src/c++11/placeholders.cc: Likewise. * src/c++11/thread.cc: Likewise. * src/c++98/bitmap_allocator.cc: Likewise. * src/c++98/hashtable_tr1.cc: Likewise. * src/c++98/list.cc: Likewise. * src/shared/hashtable-aux.cc: Likewise. * testsuite/20_util/duration/literals/range.cc: Adapt line number. * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise. * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise. * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise. * testsuite/20_util/forward/c_neg.cc: Likewise. * testsuite/20_util/forward/f_neg.cc: Likewise. * testsuite/26_numerics/gcd/gcd_neg.cc: Likewise. * testsuite/26_numerics/lcm/lcm_neg.cc: Likewise. * testsuite/26_numerics/random/pr60037-neg.cc: Likewise. * python/libstdcxx/v6/printers.py: Adapt. From-SVN: r250458
2017-07-23 08:41:35 +00:00
_GLIBCXX_END_NAMESPACE_VERSION
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 22:39:36 +00:00
} // namespace std
hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/hashtable.h: Fold in include/tr1_impl/hashtable.h for C++0x use. * include/bits/hashtable_policy.h: New, copy and adjust for C++0x use, include/tr1_impl/hashtable_policy.h; fix erase and insert member functions per n3000. * include/bits/unordered_map.h: Likewise for include/tr1_impl/ unordered_map. * include/bits/unordered_set.h: Likewise for include/tr1_impl/ unordered_set. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/tr1/unordered_map: Adjust. * include/tr1/unordered_set: Likewise. * include/tr1_impl/unordered_map: Adjust, now used only by tr1. * include/tr1_impl/hashtable: Likewise. * include/tr1_impl/hashtable_policy.h: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/std/unordered_map: Adjust and simplify includes. * include/std/unordered_set: Likewise. * include/debug/unordered_map: Adjuse erase and insert members. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/util/exception/safety.h: Fix for the updated erase and insert member functions of the unordered_containers. * testsuite/23_containers/unordered_map/erase/1.cc: New. * testsuite/23_containers/unordered_map/erase/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_single.cc: Likewise. * testsuite/23_containers/unordered_map/insert/array_syntax.cc: Likewise. * testsuite/23_containers/unordered_map/insert/24061-map.cc: Likewise. * testsuite/23_containers/unordered_map/insert/map_range.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multimap/erase/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ 24061-multimap.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/insert/ multimap_single.cc: Likewise. * testsuite/23_containers/unordered_set/erase/1.cc: Likewise. * testsuite/23_containers/unordered_set/erase/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_single.cc: Likewise. * testsuite/23_containers/unordered_set/insert/24061-set.cc: Likewise. * testsuite/23_containers/unordered_set/insert/set_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise. * testsuite/23_containers/unordered_multiset/erase/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ 24061-multiset.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/insert/ multiset_single.cc: Likewise. * testsuite/23_containers/set/operators/1_neg.cc: Tweak dg-errors to avoid spurious fails in debug-mode. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. From-SVN: r156661
2010-02-10 16:09:42 +00:00
#endif // _HASHTABLE_POLICY_H