Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _MOVE_H
00031 #define _MOVE_H 1
00032
00033 #include <bits/c++config.h>
00034 #include <bits/concept_check.h>
00035
00036 namespace std _GLIBCXX_VISIBILITY(default)
00037 {
00038 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00039
00040
00041 template<typename _Tp>
00042 inline _Tp*
00043 __addressof(_Tp& __r)
00044 {
00045 return reinterpret_cast<_Tp*>
00046 (&const_cast<char&>(reinterpret_cast<const volatile char&>(__r)));
00047 }
00048
00049 _GLIBCXX_END_NAMESPACE_VERSION
00050 }
00051
00052 #ifdef __GXX_EXPERIMENTAL_CXX0X__
00053 #include <type_traits>
00054
00055 namespace std _GLIBCXX_VISIBILITY(default)
00056 {
00057 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00058
00059
00060 template<typename _Tp>
00061 inline _Tp&&
00062 forward(typename std::remove_reference<_Tp>::type& __t)
00063 { return static_cast<_Tp&&>(__t); }
00064
00065 template<typename _Tp>
00066 inline _Tp&&
00067 forward(typename std::remove_reference<_Tp>::type&& __t)
00068 {
00069 static_assert(!std::is_lvalue_reference<_Tp>::value, "template argument"
00070 " substituting _Tp is an lvalue reference type");
00071 return static_cast<_Tp&&>(__t);
00072 }
00073
00074
00075
00076
00077
00078
00079
00080 template<typename _Tp>
00081 inline typename std::remove_reference<_Tp>::type&&
00082 move(_Tp&& __t)
00083 { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 template<typename _Tp>
00095 inline _Tp*
00096 addressof(_Tp& __r)
00097 { return std::__addressof(__r); }
00098
00099 _GLIBCXX_END_NAMESPACE_VERSION
00100 }
00101
00102 #define _GLIBCXX_MOVE(__val) std::move(__val)
00103 #define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val)
00104 #else
00105 #define _GLIBCXX_MOVE(__val) (__val)
00106 #define _GLIBCXX_FORWARD(_Tp, __val) (__val)
00107 #endif
00108
00109 namespace std _GLIBCXX_VISIBILITY(default)
00110 {
00111 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00112
00113
00114
00115
00116
00117
00118
00119
00120 template<typename _Tp>
00121 inline void
00122 swap(_Tp& __a, _Tp& __b)
00123 {
00124
00125 __glibcxx_function_requires(_SGIAssignableConcept<_Tp>)
00126
00127 _Tp __tmp = _GLIBCXX_MOVE(__a);
00128 __a = _GLIBCXX_MOVE(__b);
00129 __b = _GLIBCXX_MOVE(__tmp);
00130 }
00131
00132
00133
00134 template<typename _Tp, size_t _Nm>
00135 inline void
00136 swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
00137 {
00138 for (size_t __n = 0; __n < _Nm; ++__n)
00139 swap(__a[__n], __b[__n]);
00140 }
00141
00142 _GLIBCXX_END_NAMESPACE_VERSION
00143 }
00144
00145 #endif