libstdc++
unordered_map
Go to the documentation of this file.
00001 // <unordered_map> -*- C++ -*-
00002 
00003 // Copyright (C) 2007-2019 Free Software Foundation, Inc.
00004 //
00005 // This file is part of the GNU ISO C++ Library.  This library is free
00006 // software; you can redistribute it and/or modify it under the
00007 // terms of the GNU General Public License as published by the
00008 // Free Software Foundation; either version 3, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 
00016 // Under Section 7 of GPL version 3, you are granted additional
00017 // permissions described in the GCC Runtime Library Exception, version
00018 // 3.1, as published by the Free Software Foundation.
00019 
00020 // You should have received a copy of the GNU General Public License and
00021 // a copy of the GCC Runtime Library Exception along with this program;
00022 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
00023 // <http://www.gnu.org/licenses/>.
00024 
00025 /** @file include/unordered_map
00026  *  This is a Standard C++ Library header.
00027  */
00028 
00029 #ifndef _GLIBCXX_UNORDERED_MAP
00030 #define _GLIBCXX_UNORDERED_MAP 1
00031 
00032 #pragma GCC system_header
00033 
00034 #if __cplusplus < 201103L
00035 # include <bits/c++0x_warning.h>
00036 #else
00037 
00038 #include <type_traits>
00039 #include <initializer_list>
00040 #include <bits/allocator.h>
00041 #include <ext/alloc_traits.h>
00042 #include <ext/aligned_buffer.h>
00043 #include <bits/stl_pair.h>
00044 #include <bits/stl_function.h> // equal_to, _Identity, _Select1st
00045 #include <bits/functional_hash.h>
00046 #include <bits/hashtable.h>
00047 #include <bits/unordered_map.h>
00048 #include <bits/range_access.h>
00049 #include <bits/erase_if.h>
00050 
00051 #ifdef _GLIBCXX_DEBUG
00052 # include <debug/unordered_map>
00053 #endif
00054 
00055 #ifdef _GLIBCXX_PROFILE
00056 # include <profile/unordered_map>
00057 #endif
00058 
00059 #if __cplusplus >= 201703L
00060 namespace std _GLIBCXX_VISIBILITY(default)
00061 {
00062 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00063   namespace pmr
00064   {
00065     template<typename _Tp> class polymorphic_allocator;
00066     template<typename _Key, typename _Tp, typename _Hash = std::hash<_Key>,
00067              typename _Pred = std::equal_to<_Key>>
00068       using unordered_map
00069         = std::unordered_map<_Key, _Tp, _Hash, _Pred,
00070                              polymorphic_allocator<pair<const _Key, _Tp>>>;
00071     template<typename _Key, typename _Tp, typename _Hash = std::hash<_Key>,
00072              typename _Pred = std::equal_to<_Key>>
00073       using unordered_multimap
00074         = std::unordered_multimap<_Key, _Tp, _Hash, _Pred,
00075                                   polymorphic_allocator<pair<const _Key, _Tp>>>;
00076   } // namespace pmr
00077 _GLIBCXX_END_NAMESPACE_VERSION
00078 } // namespace std
00079 #endif // C++17
00080 
00081 #if __cplusplus > 201703L
00082 namespace std _GLIBCXX_VISIBILITY(default)
00083 {
00084 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00085   template<typename _Key, typename _Tp, typename _Hash, typename _CPred,
00086            typename _Alloc, typename _Predicate>
00087     inline typename unordered_map<_Key, _Tp, _Hash, _CPred, _Alloc>::size_type
00088     erase_if(unordered_map<_Key, _Tp, _Hash, _CPred, _Alloc>& __cont,
00089              _Predicate __pred)
00090     { return __detail::__erase_nodes_if(__cont, __pred); }
00091 
00092   template<typename _Key, typename _Tp, typename _Hash, typename _CPred,
00093            typename _Alloc, typename _Predicate>
00094     inline typename unordered_multimap<_Key, _Tp, _Hash, _CPred, _Alloc>::
00095                     size_type
00096     erase_if(unordered_multimap<_Key, _Tp, _Hash, _CPred, _Alloc>& __cont,
00097              _Predicate __pred)
00098     { return __detail::__erase_nodes_if(__cont, __pred); }
00099 _GLIBCXX_END_NAMESPACE_VERSION
00100 } // namespace std
00101 #endif // C++20
00102 
00103 #endif // C++11
00104 
00105 #endif // _GLIBCXX_UNORDERED_MAP