| 1 |
// { dg-do compile } |
| 2 |
// { dg-require-normal-namespace "" } |
| 3 |
|
| 4 |
// Copyright (C) 2007-2025 Free Software Foundation, Inc. |
| 5 |
// |
| 6 |
// This file is part of the GNU ISO C++ Library. This library is free |
| 7 |
// software; you can redistribute it and/or modify it under the |
| 8 |
// terms of the GNU General Public License as published by the |
| 9 |
// Free Software Foundation; either version 3, or (at your option) |
| 10 |
// any later version. |
| 11 |
|
| 12 |
// This library is distributed in the hope that it will be useful, |
| 13 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
// GNU General Public License for more details. |
| 16 |
|
| 17 |
// You should have received a copy of the GNU General Public License along |
| 18 |
// with this library; see the file COPYING3. If not see |
| 19 |
// <http://www.gnu.org/licenses/>. |
| 20 |
|
| 21 |
#include <memory> |
| 22 |
|
| 23 |
#if __cplusplus >= 201103L |
| 24 |
# define NOTHROW noexcept |
| 25 |
#else |
| 26 |
# define NOTHROW |
| 27 |
#endif |
| 28 |
|
| 29 |
namespace std |
| 30 |
{ |
| 31 |
#if __cplusplus >= 201103L |
| 32 |
template<class Ptr> struct pointer_traits; |
| 33 |
template<class T> struct pointer_traits<T*>; |
| 34 |
|
| 35 |
void* align(size_t alignment, size_t size, void*& ptr, size_t& space) noexcept; |
| 36 |
|
| 37 |
struct allocator_arg_t; |
| 38 |
extern const allocator_arg_t allocator_arg; |
| 39 |
|
| 40 |
template<class T, class Alloc> struct uses_allocator; |
| 41 |
|
| 42 |
template<class Alloc> struct allocator_traits; |
| 43 |
#endif // C++11 |
| 44 |
|
| 45 |
#if __STDC_HOSTED__ |
| 46 |
// lib.default.allocator, the default allocator: |
| 47 |
template <class T> class allocator; |
| 48 |
#if __cplusplus >= 202002L |
| 49 |
template <class T, class U> |
| 50 |
constexpr bool operator==(const allocator<T>&, const allocator<U>&) throw(); |
| 51 |
#else |
| 52 |
template <> class allocator<void>; |
| 53 |
template <class T, class U> |
| 54 |
bool operator==(const allocator<T>&, const allocator<U>&) throw(); |
| 55 |
template <class T, class U> |
| 56 |
bool operator!=(const allocator<T>&, const allocator<U>&) throw(); |
| 57 |
#endif |
| 58 |
|
| 59 |
// lib.storage.iterator, raw storage iterator: |
| 60 |
template <class OutputIterator, class T> class raw_storage_iterator; |
| 61 |
|
| 62 |
// lib.temporary.buffer, temporary buffers: |
| 63 |
template <class T> |
| 64 |
pair<T*,ptrdiff_t> get_temporary_buffer(ptrdiff_t n) NOTHROW; |
| 65 |
template <class T> |
| 66 |
void return_temporary_buffer(T* p); |
| 67 |
#endif // HOSTED |
| 68 |
|
| 69 |
// lib.specialized.algorithms, specialized algorithms: |
| 70 |
#if __cplusplus >= 201703L |
| 71 |
template <class T> constexpr T* addressof(T&) noexcept; |
| 72 |
#elif __cplusplus >= 201402L |
| 73 |
template <class T> T* addressof(T&) noexcept; |
| 74 |
#endif |
| 75 |
template <class InputIterator, class ForwardIterator> |
| 76 |
#if __cplusplus >= 202400L |
| 77 |
constexpr |
| 78 |
#endif |
| 79 |
ForwardIterator |
| 80 |
uninitialized_copy(InputIterator first, InputIterator last, |
| 81 |
ForwardIterator result); |
| 82 |
#if __cplusplus >= 201103L |
| 83 |
template <class InputIterator, class Size, class ForwardIterator> |
| 84 |
#if __cplusplus >= 202400L |
| 85 |
constexpr |
| 86 |
#endif |
| 87 |
ForwardIterator |
| 88 |
uninitialized_copy_n(InputIterator first, Size n, ForwardIterator result); |
| 89 |
#endif |
| 90 |
template <class ForwardIterator, class T> |
| 91 |
#if __cplusplus >= 202400L |
| 92 |
constexpr |
| 93 |
#endif |
| 94 |
void uninitialized_fill(ForwardIterator first, ForwardIterator last, |
| 95 |
const T& x); |
| 96 |
template <class ForwardIterator, class Size, class T> |
| 97 |
#if __cplusplus >= 202400L |
| 98 |
constexpr |
| 99 |
#endif |
| 100 |
void uninitialized_fill_n(ForwardIterator first, Size n, const T& x); |
| 101 |
|
| 102 |
#if __cplusplus >= 201103L |
| 103 |
template<class T> class default_delete; |
| 104 |
template<class T> class default_delete<T[]>; |
| 105 |
template<class T, class D> class unique_ptr; |
| 106 |
template<class T, class D> class unique_ptr<T[], D>; |
| 107 |
template<class T, class D> |
| 108 |
void swap(unique_ptr<T, D>&, unique_ptr<T, D>&) noexcept; |
| 109 |
#if __cplusplus >= 201402L |
| 110 |
template<class T, class... Args> unique_ptr<T> make_unique(Args&&...); |
| 111 |
#endif |
| 112 |
|
| 113 |
class bad_weak_ptr; |
| 114 |
template<class T> class shared_ptr; |
| 115 |
template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args); |
| 116 |
template<class T, class A, class... Args> |
| 117 |
shared_ptr<T> allocate_shared(const A& a, Args&&... args); |
| 118 |
template<class T> void swap(shared_ptr<T>&, shared_ptr<T>&) noexcept; |
| 119 |
template<class T> class weak_ptr; |
| 120 |
template<class T> void swap(weak_ptr<T>&, weak_ptr<T>&) noexcept; |
| 121 |
template<class T> class owner_less; |
| 122 |
template<class T> class enable_shared_from_this; |
| 123 |
|
| 124 |
template<class T, class D> struct hash<unique_ptr<T, D>>; |
| 125 |
template<class T> struct hash<shared_ptr<T>>; |
| 126 |
#endif |
| 127 |
|
| 128 |
// lib.auto.ptr, pointers: |
| 129 |
template<class X> class auto_ptr; |
| 130 |
} |