memory 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. // <memory> -*- C++ -*-
  2. // Copyright (C) 2001-2022 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. * Copyright (c) 1997-1999
  22. * Silicon Graphics Computer Systems, Inc.
  23. *
  24. * Permission to use, copy, modify, distribute and sell this software
  25. * and its documentation for any purpose is hereby granted without fee,
  26. * provided that the above copyright notice appear in all copies and
  27. * that both that copyright notice and this permission notice appear
  28. * in supporting documentation. Silicon Graphics makes no
  29. * representations about the suitability of this software for any
  30. * purpose. It is provided "as is" without express or implied warranty.
  31. *
  32. */
  33. /** @file include/memory
  34. * This is a Standard C++ Library header.
  35. * @ingroup memory
  36. */
  37. #ifndef _GLIBCXX_MEMORY
  38. #define _GLIBCXX_MEMORY 1
  39. #pragma GCC system_header
  40. /**
  41. * @defgroup memory Memory
  42. * @ingroup utilities
  43. *
  44. * Components for memory allocation, deallocation, and management.
  45. */
  46. /**
  47. * @defgroup pointer_abstractions Pointer Abstractions
  48. * @ingroup memory
  49. *
  50. * Smart pointers, etc.
  51. */
  52. #include <bits/stl_algobase.h>
  53. #include <bits/allocator.h>
  54. #include <bits/stl_construct.h>
  55. #include <bits/stl_uninitialized.h>
  56. #include <bits/stl_tempbuf.h>
  57. #include <bits/stl_raw_storage_iter.h>
  58. #if __cplusplus >= 201103L
  59. # include <type_traits>
  60. # include <bits/align.h>
  61. # include <bits/uses_allocator.h>
  62. # include <bits/alloc_traits.h>
  63. # include <debug/debug.h>
  64. # include <bits/unique_ptr.h>
  65. # include <bits/shared_ptr.h>
  66. # include <bits/shared_ptr_atomic.h>
  67. #endif
  68. #if __cplusplus < 201103L || _GLIBCXX_USE_DEPRECATED
  69. # include <backward/auto_ptr.h>
  70. #endif
  71. #if __cplusplus > 201703L
  72. # include <bits/ranges_uninitialized.h>
  73. # include <bits/uses_allocator_args.h>
  74. #endif
  75. #if __cplusplus >= 201103L && __cplusplus <= 202002L
  76. namespace std _GLIBCXX_VISIBILITY(default)
  77. {
  78. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  79. /** @defgroup ptr_safety Pointer Safety and Garbage Collection
  80. * @ingroup memory
  81. *
  82. * Utilities to assist with garbage collection in an implementation
  83. * that supports <em>strict pointer safety</em>.
  84. * This implementation only supports <em>relaxed pointer safety</em>
  85. * and so these functions have no effect.
  86. *
  87. * C++11 20.6.4 [util.dynamic.safety], Pointer safety
  88. *
  89. * @{
  90. */
  91. /// Constants representing the different types of pointer safety.
  92. enum class pointer_safety { relaxed, preferred, strict };
  93. /// Inform a garbage collector that an object is still in use.
  94. inline void
  95. declare_reachable(void*) { }
  96. /// Unregister an object previously registered with declare_reachable.
  97. template <typename _Tp>
  98. inline _Tp*
  99. undeclare_reachable(_Tp* __p) { return __p; }
  100. /// Inform a garbage collector that a region of memory need not be traced.
  101. inline void
  102. declare_no_pointers(char*, size_t) { }
  103. /// Unregister a range previously registered with declare_no_pointers.
  104. inline void
  105. undeclare_no_pointers(char*, size_t) { }
  106. /// The type of pointer safety supported by the implementation.
  107. inline pointer_safety
  108. get_pointer_safety() noexcept { return pointer_safety::relaxed; }
  109. /// @}
  110. _GLIBCXX_END_NAMESPACE_VERSION
  111. } // namespace
  112. #endif // C++11 to C++20
  113. #if __cplusplus >= 201703L
  114. // Parallel STL algorithms
  115. # if _PSTL_EXECUTION_POLICIES_DEFINED
  116. // If <execution> has already been included, pull in implementations
  117. # include <pstl/glue_memory_impl.h>
  118. # else
  119. // Otherwise just pull in forward declarations
  120. # include <pstl/glue_memory_defs.h>
  121. # endif
  122. // Feature test macro for parallel algorithms
  123. # define __cpp_lib_parallel_algorithm 201603L
  124. #endif // C++17
  125. #endif /* _GLIBCXX_MEMORY */