You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // <map> -*- C++ -*-
  2. // Copyright (C) 2001-2020 Free Software Foundation, Inc.
  3. //
  4. // This file is part of the GNU ISO C++ Library. This library is free
  5. // software; you can redistribute it and/or modify it under the
  6. // terms of the GNU General Public License as published by the
  7. // Free Software Foundation; either version 3, or (at your option)
  8. // any later version.
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. // Under Section 7 of GPL version 3, you are granted additional
  14. // permissions described in the GCC Runtime Library Exception, version
  15. // 3.1, as published by the Free Software Foundation.
  16. // You should have received a copy of the GNU General Public License and
  17. // a copy of the GCC Runtime Library Exception along with this program;
  18. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. // <http://www.gnu.org/licenses/>.
  20. /*
  21. *
  22. * Copyright (c) 1994
  23. * Hewlett-Packard Company
  24. *
  25. * Permission to use, copy, modify, distribute and sell this software
  26. * and its documentation for any purpose is hereby granted without fee,
  27. * provided that the above copyright notice appear in all copies and
  28. * that both that copyright notice and this permission notice appear
  29. * in supporting documentation. Hewlett-Packard Company makes no
  30. * representations about the suitability of this software for any
  31. * purpose. It is provided "as is" without express or implied warranty.
  32. *
  33. *
  34. * Copyright (c) 1996,1997
  35. * Silicon Graphics Computer Systems, Inc.
  36. *
  37. * Permission to use, copy, modify, distribute and sell this software
  38. * and its documentation for any purpose is hereby granted without fee,
  39. * provided that the above copyright notice appear in all copies and
  40. * that both that copyright notice and this permission notice appear
  41. * in supporting documentation. Silicon Graphics makes no
  42. * representations about the suitability of this software for any
  43. * purpose. It is provided "as is" without express or implied warranty.
  44. */
  45. /** @file include/map
  46. * This is a Standard C++ Library header.
  47. */
  48. #ifndef _GLIBCXX_MAP
  49. #define _GLIBCXX_MAP 1
  50. #pragma GCC system_header
  51. #include <bits/stl_tree.h>
  52. #include <bits/stl_map.h>
  53. #include <bits/stl_multimap.h>
  54. #include <bits/range_access.h>
  55. #include <bits/erase_if.h>
  56. #ifdef _GLIBCXX_DEBUG
  57. # include <debug/map>
  58. #endif
  59. #if __cplusplus >= 201703L
  60. namespace std _GLIBCXX_VISIBILITY(default)
  61. {
  62. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  63. namespace pmr
  64. {
  65. template<typename _Tp> class polymorphic_allocator;
  66. template<typename _Key, typename _Tp, typename _Cmp = std::less<_Key>>
  67. using map
  68. = std::map<_Key, _Tp, _Cmp,
  69. polymorphic_allocator<pair<const _Key, _Tp>>>;
  70. template<typename _Key, typename _Tp, typename _Cmp = std::less<_Key>>
  71. using multimap
  72. = std::multimap<_Key, _Tp, _Cmp,
  73. polymorphic_allocator<pair<const _Key, _Tp>>>;
  74. } // namespace pmr
  75. _GLIBCXX_END_NAMESPACE_VERSION
  76. } // namespace std
  77. #endif // C++17
  78. #if __cplusplus > 201703L
  79. namespace std _GLIBCXX_VISIBILITY(default)
  80. {
  81. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  82. template<typename _Key, typename _Tp, typename _Compare, typename _Alloc,
  83. typename _Predicate>
  84. inline typename map<_Key, _Tp, _Compare, _Alloc>::size_type
  85. erase_if(map<_Key, _Tp, _Compare, _Alloc>& __cont, _Predicate __pred)
  86. { return __detail::__erase_nodes_if(__cont, __pred); }
  87. template<typename _Key, typename _Tp, typename _Compare, typename _Alloc,
  88. typename _Predicate>
  89. inline typename multimap<_Key, _Tp, _Compare, _Alloc>::size_type
  90. erase_if(multimap<_Key, _Tp, _Compare, _Alloc>& __cont, _Predicate __pred)
  91. { return __detail::__erase_nodes_if(__cont, __pred); }
  92. _GLIBCXX_END_NAMESPACE_VERSION
  93. } // namespace std
  94. #endif // C++20
  95. #endif /* _GLIBCXX_MAP */