14fee23f9Smrg// <memory> -*- C++ -*- 24fee23f9Smrg 3*b1e83836Smrg// Copyright (C) 2001-2022 Free Software Foundation, Inc. 44fee23f9Smrg// 54fee23f9Smrg// This file is part of the GNU ISO C++ Library. This library is free 64fee23f9Smrg// software; you can redistribute it and/or modify it under the 74fee23f9Smrg// terms of the GNU General Public License as published by the 84fee23f9Smrg// Free Software Foundation; either version 3, or (at your option) 94fee23f9Smrg// any later version. 104fee23f9Smrg 114fee23f9Smrg// This library is distributed in the hope that it will be useful, 124fee23f9Smrg// but WITHOUT ANY WARRANTY; without even the implied warranty of 134fee23f9Smrg// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 144fee23f9Smrg// GNU General Public License for more details. 154fee23f9Smrg 164fee23f9Smrg// Under Section 7 of GPL version 3, you are granted additional 174fee23f9Smrg// permissions described in the GCC Runtime Library Exception, version 184fee23f9Smrg// 3.1, as published by the Free Software Foundation. 194fee23f9Smrg 204fee23f9Smrg// You should have received a copy of the GNU General Public License and 214fee23f9Smrg// a copy of the GCC Runtime Library Exception along with this program; 224fee23f9Smrg// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 234fee23f9Smrg// <http://www.gnu.org/licenses/>. 244fee23f9Smrg 254fee23f9Smrg/* 264fee23f9Smrg * Copyright (c) 1997-1999 274fee23f9Smrg * Silicon Graphics Computer Systems, Inc. 284fee23f9Smrg * 294fee23f9Smrg * Permission to use, copy, modify, distribute and sell this software 304fee23f9Smrg * and its documentation for any purpose is hereby granted without fee, 314fee23f9Smrg * provided that the above copyright notice appear in all copies and 324fee23f9Smrg * that both that copyright notice and this permission notice appear 334fee23f9Smrg * in supporting documentation. Silicon Graphics makes no 344fee23f9Smrg * representations about the suitability of this software for any 354fee23f9Smrg * purpose. It is provided "as is" without express or implied warranty. 364fee23f9Smrg * 374fee23f9Smrg */ 384fee23f9Smrg 394fee23f9Smrg/** @file include/memory 404fee23f9Smrg * This is a Standard C++ Library header. 41fb8a8121Smrg * @ingroup memory 424fee23f9Smrg */ 434fee23f9Smrg 444fee23f9Smrg#ifndef _GLIBCXX_MEMORY 454fee23f9Smrg#define _GLIBCXX_MEMORY 1 464fee23f9Smrg 474fee23f9Smrg#pragma GCC system_header 484fee23f9Smrg 494fee23f9Smrg/** 504fee23f9Smrg * @defgroup memory Memory 514fee23f9Smrg * @ingroup utilities 524fee23f9Smrg * 534fee23f9Smrg * Components for memory allocation, deallocation, and management. 544fee23f9Smrg */ 554fee23f9Smrg 564fee23f9Smrg/** 574fee23f9Smrg * @defgroup pointer_abstractions Pointer Abstractions 584fee23f9Smrg * @ingroup memory 594fee23f9Smrg * 604fee23f9Smrg * Smart pointers, etc. 614fee23f9Smrg */ 624fee23f9Smrg 634fee23f9Smrg#include <bits/allocator.h> 644fee23f9Smrg#include <bits/stl_construct.h> 654fee23f9Smrg#include <bits/stl_uninitialized.h> 664fee23f9Smrg#include <bits/stl_tempbuf.h> 674fee23f9Smrg#include <bits/stl_raw_storage_iter.h> 684fee23f9Smrg 6948fb7bfaSmrg#if __cplusplus >= 201103L 70*b1e83836Smrg# include <type_traits> 71*b1e83836Smrg# include <bits/align.h> 7248fb7bfaSmrg# include <bits/uses_allocator.h> 73fb8a8121Smrg# include <bits/alloc_traits.h> 744fee23f9Smrg# include <debug/debug.h> 754fee23f9Smrg# include <bits/unique_ptr.h> 7648fb7bfaSmrg# include <bits/shared_ptr.h> 774d5abbe8Smrg# include <bits/shared_ptr_atomic.h> 784fee23f9Smrg#endif 79*b1e83836Smrg 80*b1e83836Smrg#if __cplusplus < 201103L || _GLIBCXX_USE_DEPRECATED 814fee23f9Smrg# include <backward/auto_ptr.h> 824fee23f9Smrg#endif 834fee23f9Smrg 84181254a7Smrg#if __cplusplus > 201703L 85*b1e83836Smrg# include <bits/ranges_uninitialized.h> 86*b1e83836Smrg# include <bits/uses_allocator_args.h> 87181254a7Smrg#endif 88*b1e83836Smrg 89*b1e83836Smrg#if __cplusplus >= 201103L && __cplusplus <= 202002L 904d5abbe8Smrgnamespace std _GLIBCXX_VISIBILITY(default) 914d5abbe8Smrg{ 924d5abbe8Smrg_GLIBCXX_BEGIN_NAMESPACE_VERSION 934d5abbe8Smrg 94fb8a8121Smrg/** @defgroup ptr_safety Pointer Safety and Garbage Collection 95fb8a8121Smrg * @ingroup memory 96fb8a8121Smrg * 97fb8a8121Smrg * Utilities to assist with garbage collection in an implementation 98fb8a8121Smrg * that supports <em>strict pointer safety</em>. 99fb8a8121Smrg * This implementation only supports <em>relaxed pointer safety</em> 100fb8a8121Smrg * and so these functions have no effect. 101fb8a8121Smrg * 102fb8a8121Smrg * C++11 20.6.4 [util.dynamic.safety], Pointer safety 103fb8a8121Smrg * 104fb8a8121Smrg * @{ 105fb8a8121Smrg */ 106f9a78e0eSmrg 107fb8a8121Smrg/// Constants representing the different types of pointer safety. 108f9a78e0eSmrgenum class pointer_safety { relaxed, preferred, strict }; 109f9a78e0eSmrg 110fb8a8121Smrg/// Inform a garbage collector that an object is still in use. 111f9a78e0eSmrginline void 112f9a78e0eSmrgdeclare_reachable(void*) { } 113f9a78e0eSmrg 114fb8a8121Smrg/// Unregister an object previously registered with declare_reachable. 115f9a78e0eSmrgtemplate <typename _Tp> 116f9a78e0eSmrg inline _Tp* 117f9a78e0eSmrg undeclare_reachable(_Tp* __p) { return __p; } 118f9a78e0eSmrg 119fb8a8121Smrg/// Inform a garbage collector that a region of memory need not be traced. 120f9a78e0eSmrginline void 121f9a78e0eSmrgdeclare_no_pointers(char*, size_t) { } 122f9a78e0eSmrg 123fb8a8121Smrg/// Unregister a range previously registered with declare_no_pointers. 124f9a78e0eSmrginline void 125f9a78e0eSmrgundeclare_no_pointers(char*, size_t) { } 126f9a78e0eSmrg 127fb8a8121Smrg/// The type of pointer safety supported by the implementation. 128f9a78e0eSmrginline pointer_safety 129f9a78e0eSmrgget_pointer_safety() noexcept { return pointer_safety::relaxed; } 130a448f87cSmrg/// @} 131f9a78e0eSmrg 1324d5abbe8Smrg_GLIBCXX_END_NAMESPACE_VERSION 1334d5abbe8Smrg} // namespace 134*b1e83836Smrg#endif // C++11 to C++20 1354d5abbe8Smrg 136*b1e83836Smrg#if __cplusplus >= 201703L 137181254a7Smrg// Parallel STL algorithms 138fb8a8121Smrg# if _PSTL_EXECUTION_POLICIES_DEFINED 139181254a7Smrg// If <execution> has already been included, pull in implementations 140181254a7Smrg# include <pstl/glue_memory_impl.h> 141181254a7Smrg# else 142181254a7Smrg// Otherwise just pull in forward declarations 143181254a7Smrg# include <pstl/glue_memory_defs.h> 144181254a7Smrg# endif 145181254a7Smrg 146181254a7Smrg// Feature test macro for parallel algorithms 147181254a7Smrg# define __cpp_lib_parallel_algorithm 201603L 148181254a7Smrg#endif // C++17 149181254a7Smrg 1504fee23f9Smrg#endif /* _GLIBCXX_MEMORY */ 151