34#if __cplusplus < 201103L
40namespace std _GLIBCXX_VISIBILITY(default)
42_GLIBCXX_BEGIN_NAMESPACE_VERSION
49 template<
typename _Tp>
50 inline _GLIBCXX_CONSTEXPR _Tp*
54#if __cplusplus >= 201103L
68 template<
typename _Tp>
71 forward(
typename std::remove_reference<_Tp>::type& __t)
noexcept
72 {
return static_cast<_Tp&&
>(__t); }
81 template<
typename _Tp>
84 forward(
typename std::remove_reference<_Tp>::type&& __t)
noexcept
87 "std::forward must not be used to convert an rvalue to an lvalue");
88 return static_cast<_Tp&&
>(__t);
91#if __glibcxx_forward_like
92 template<
typename _Tp,
typename _Up>
95 template<
typename _Tp,
typename _Up>
96 struct __like_impl<_Tp&, _Up&>
97 {
using type = _Up&; };
99 template<
typename _Tp,
typename _Up>
100 struct __like_impl<const _Tp&, _Up&>
101 {
using type =
const _Up&; };
103 template<
typename _Tp,
typename _Up>
104 struct __like_impl<_Tp&&, _Up&>
105 {
using type = _Up&&; };
107 template<
typename _Tp,
typename _Up>
108 struct __like_impl<const _Tp&&, _Up&>
109 {
using type =
const _Up&&; };
111 template<
typename _Tp,
typename _Up>
112 using __like_t =
typename __like_impl<_Tp&&, _Up&>::type;
121 template<
typename _Tp,
typename _Up>
123 constexpr __like_t<_Tp, _Up>
124 forward_like(_Up&& __x)
noexcept
125 {
return static_cast<__like_t<_Tp, _Up>
>(__x); }
134 template<
typename _Tp>
136 constexpr typename std::remove_reference<_Tp>::type&&
138 {
return static_cast<typename std::remove_reference<_Tp>::type&&
>(__t); }
141 template<
typename _Tp>
142 struct __move_if_noexcept_cond
143 :
public __and_<__not_<is_nothrow_move_constructible<_Tp>>,
144 is_copy_constructible<_Tp>>::type { };
155 template<
typename _Tp>
158 __conditional_t<__move_if_noexcept_cond<_Tp>::value,
const _Tp&, _Tp&&>
172 template<
typename _Tp>
174 inline _GLIBCXX17_CONSTEXPR _Tp*
180 template<
typename _Tp>
181 const _Tp*
addressof(
const _Tp&&) =
delete;
184 template <
typename _Tp,
typename _Up = _Tp>
187 __exchange(_Tp& __obj, _Up&& __new_val)
196#define _GLIBCXX_FWDREF(_Tp) _Tp&&
197#define _GLIBCXX_MOVE(__val) std::move(__val)
198#define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val)
200#define _GLIBCXX_FWDREF(_Tp) const _Tp&
201#define _GLIBCXX_MOVE(__val) (__val)
202#define _GLIBCXX_FORWARD(_Tp, __val) (__val)
216 template<
typename _Tp>
219#if __cplusplus >= 201103L
220 typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>,
221 is_move_constructible<_Tp>,
222 is_move_assignable<_Tp>>::value>::type
226 swap(_Tp& __a, _Tp& __b)
230#if __cplusplus < 201103L
234 _Tp
__tmp = _GLIBCXX_MOVE(__a);
235 __a = _GLIBCXX_MOVE(__b);
236 __b = _GLIBCXX_MOVE(
__tmp);
242 template<
typename _Tp,
size_t _Nm>
245#if __cplusplus >= 201103L
246 typename enable_if<__is_swappable<_Tp>::value>::type
253 for (
size_t __n = 0; __n <
_Nm; ++__n)
254 swap(__a[__n], __b[__n]);
258_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.