34#if __cplusplus < 201103L
40namespace std _GLIBCXX_VISIBILITY(default)
42_GLIBCXX_BEGIN_NAMESPACE_VERSION
49 template<
typename _Tp>
50 inline _GLIBCXX_CONSTEXPR _Tp*
52 {
return __builtin_addressof(__r); }
54#if __cplusplus >= 201103L
67 template<
typename _Tp>
70 forward(
typename std::remove_reference<_Tp>::type& __t)
noexcept
71 {
return static_cast<_Tp&&
>(__t); }
79 template<
typename _Tp>
82 forward(
typename std::remove_reference<_Tp>::type&& __t)
noexcept
85 "std::forward must not be used to convert an rvalue to an lvalue");
86 return static_cast<_Tp&&
>(__t);
89#if __glibcxx_forward_like
90 template<
typename _Tp,
typename _Up>
92 constexpr decltype(
auto)
93 forward_like(_Up&& __x)
noexcept
95 constexpr bool __as_rval = is_rvalue_reference_v<_Tp&&>;
97 if constexpr (is_const_v<remove_reference_t<_Tp>>)
99 using _Up2 = remove_reference_t<_Up>;
100 if constexpr (__as_rval)
101 return static_cast<const _Up2&&
>(__x);
103 return static_cast<const _Up2&
>(__x);
107 if constexpr (__as_rval)
108 return static_cast<remove_reference_t<_Up>&&
>(__x);
110 return static_cast<_Up&
>(__x);
114 template<
typename _Tp,
typename _Up>
115 using __like_t =
decltype(std::forward_like<_Tp>(std::declval<_Up>()));
123 template<
typename _Tp>
125 constexpr typename std::remove_reference<_Tp>::type&&
127 {
return static_cast<typename std::remove_reference<_Tp>::type&&
>(__t); }
130 template<
typename _Tp>
131 struct __move_if_noexcept_cond
132 :
public __and_<__not_<is_nothrow_move_constructible<_Tp>>,
133 is_copy_constructible<_Tp>>::type { };
143 template<
typename _Tp>
146 __conditional_t<__move_if_noexcept_cond<_Tp>::value,
const _Tp&, _Tp&&>
159 template<
typename _Tp>
161 inline _GLIBCXX17_CONSTEXPR _Tp*
167 template<
typename _Tp>
168 const _Tp*
addressof(
const _Tp&&) =
delete;
171 template <
typename _Tp,
typename _Up = _Tp>
174 __exchange(_Tp& __obj, _Up&& __new_val)
177 __obj = std::forward<_Up>(__new_val);
183#define _GLIBCXX_FWDREF(_Tp) _Tp&&
184#define _GLIBCXX_MOVE(__val) std::move(__val)
185#define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val)
187#define _GLIBCXX_FWDREF(_Tp) const _Tp&
188#define _GLIBCXX_MOVE(__val) (__val)
189#define _GLIBCXX_FORWARD(_Tp, __val) (__val)
203 template<
typename _Tp>
206#if __cplusplus >= 201103L
207 typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>,
208 is_move_constructible<_Tp>,
209 is_move_assignable<_Tp>>::value>::type
213 swap(_Tp& __a, _Tp& __b)
217#if __cplusplus < 201103L
219 __glibcxx_function_requires(_SGIAssignableConcept<_Tp>)
221 _Tp __tmp = _GLIBCXX_MOVE(__a);
222 __a = _GLIBCXX_MOVE(__b);
223 __b = _GLIBCXX_MOVE(__tmp);
229 template<
typename _Tp,
size_t _Nm>
232#if __cplusplus >= 201103L
233 typename enable_if<__is_swappable<_Tp>::value>::type
237 swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
238 _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Tp>::value)
240 for (
size_t __n = 0; __n < _Nm; ++__n)
241 swap(__a[__n], __b[__n]);
245_GLIBCXX_END_NAMESPACE_VERSION
constexpr __conditional_t< __move_if_noexcept_cond< _Tp >::value, const _Tp &, _Tp && > move_if_noexcept(_Tp &__x) noexcept
Conditionally convert a value to an rvalue.
constexpr _Tp * addressof(_Tp &__r) noexcept
Returns the actual address of the object or function referenced by r, even in the presence of an over...
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
ISO C++ entities toplevel namespace is std.
is_nothrow_move_constructible
is_nothrow_move_assignable