Debian Codegraph @

libstdc++-v3/testsuite/20_util/headers/utility/synopsis.cc

raw
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 <utility>
22
23 #if __cplusplus < 201103L
24 # define CONSTEXPR
25 #else
26 # define CONSTEXPR constexpr
27 #endif
28
29 #if __cplusplus < 201402L && ! defined(_GLIBCXX_RELEASE)
30 # define CONSTEXPR11x
31 #else
32 # define CONSTEXPR11x constexpr
33 #endif
34
35 #if __cplusplus < 201402L
36 # define CONSTEXPR14
37 #else
38 # define CONSTEXPR14 constexpr
39 #endif
40
41 #if __cplusplus < 201703L
42 # define CONSTEXPR17
43 #else
44 # define CONSTEXPR17 constexpr
45 #endif
46
47 #if __cplusplus < 202002L
48 # define CONSTEXPR20
49 #else
50 # define CONSTEXPR20 constexpr
51 #endif
52
53 namespace std {
54 // lib.operators, operators:
55 namespace rel_ops {
56 template<class T> bool operator!=(const T&, const T&);
57 template<class T> bool operator> (const T&, const T&);
58 template<class T> bool operator<=(const T&, const T&);
59 template<class T> bool operator>=(const T&, const T&);
60 }
61
62 #if __cplusplus >= 201103L
63 #if 0
64 // N.B. our std::swap doesn't actually match this due to constraints on
65 // the template parameter.
66 template<class T>
67 CONSTEXPR20
68 void swap(T&, T&) noexcept(is_nothrow_move_constructible<T>::value
69 && is_nothrow_move_assignable<T>::value);
70 #endif
71
72 template<class T, size_t N>
73 CONSTEXPR20
74 void swap(T (&a)[N], T (&b)[N]) noexcept(noexcept(swap(*a, *b)));
75
76 #if __cplusplus >= 201703L
77 template <class T, class U /* = T */>
78 CONSTEXPR20
79 T exchange(T& obj, U&& new_val)
80 #if defined _GLIBCXX_RELEASE // This noexcept is a libstdc++ extension.
81 noexcept(__and_<is_nothrow_move_constructible<T>,
82 is_nothrow_assignable<T&, U>>::value)
83 #endif
84 ;
85 #endif
86
87 template<class T>
88 CONSTEXPR11x
89 T&& forward(typename remove_reference<T>::type& t) noexcept;
90 template<class T>
91 CONSTEXPR11x
92 T&& forward(typename remove_reference<T>::type&& t) noexcept;
93
94 template<class T>
95 CONSTEXPR11x
96 typename remove_reference<T>::type&& move(T&& t) noexcept;
97
98 template<class T>
99 CONSTEXPR17
100 typename conditional< ! is_nothrow_move_constructible<T>::value
101 && is_copy_constructible<T>::value,
102 const T&, T&&>::type
103 move_if_noexcept(T& x) noexcept;
104
105 #if __cplusplus >= 201703L
106 template<class T>
107 constexpr add_const_t<T>& as_const(T& t) noexcept;
108 #endif
109
110 template <class T>
111 typename add_rvalue_reference<T>::type declval() noexcept;
112
113 #if __cplusplus >= 201402L
114 template<class T, T...> struct integer_sequence;
115 #endif
116
117 #endif // C++11
118
119 // lib.pairs, pairs:
120 template <class T1, class T2> struct pair;
121 template <class T1, class T2>
122 CONSTEXPR bool operator==(const pair<T1,T2>&, const pair<T1,T2>&);
123 template <class T1, class T2>
124 CONSTEXPR bool operator< (const pair<T1,T2>&, const pair<T1,T2>&);
125 template <class T1, class T2>
126 CONSTEXPR bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&);
127 template <class T1, class T2>
128 CONSTEXPR bool operator> (const pair<T1,T2>&, const pair<T1,T2>&);
129 template <class T1, class T2>
130 CONSTEXPR bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&);
131 template <class T1, class T2>
132 CONSTEXPR bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&);
133
134 #if __cplusplus >= 201103L
135 struct piecewise_construct_t;
136 #if __cplusplus >= 201703L
137 struct in_place_t;
138 template<class> struct in_place_type_t;
139 template<size_t> struct in_place_index_t;
140
141 #if __cplusplus > 202302L
142 struct monostate;
143 template<> struct hash<monostate>;
144 #endif
145 #endif
146 #endif
147 }