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 _GLIBCXX_BEGIN_NAMESPACE(std)
00037
00038
00039 template<typename _Tp>
00040 inline _Tp*
00041 __addressof(_Tp& __r)
00042 {
00043 return reinterpret_cast<_Tp*>
00044 (&const_cast<char&>(reinterpret_cast<const volatile char&>(__r)));
00045 }
00046
00047 _GLIBCXX_END_NAMESPACE
00048
00049 #ifdef __GXX_EXPERIMENTAL_CXX0X__
00050 #include <type_traits>
00051
00052 _GLIBCXX_BEGIN_NAMESPACE(std)
00053
00054
00055
00056 template<typename _Tp>
00057 inline typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp&&>::type
00058 forward(typename std::common_type<_Tp>::type& __t)
00059 { return static_cast<_Tp&&>(__t); }
00060
00061
00062 template<typename _Tp>
00063 inline typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp&&>::type
00064 forward(typename std::common_type<_Tp>::type&& __t)
00065 { return static_cast<_Tp&&>(__t); }
00066
00067
00068 template<typename _Tp>
00069 inline typename enable_if<is_lvalue_reference<_Tp>::value, _Tp>::type
00070 forward(typename std::common_type<_Tp>::type __t)
00071 { return __t; }
00072
00073
00074 template<typename _Tp>
00075 inline typename enable_if<is_lvalue_reference<_Tp>::value, _Tp>::type
00076 forward(typename std::remove_reference<_Tp>::type&& __t) = delete;
00077
00078
00079
00080
00081
00082
00083
00084 template<typename _Tp>
00085 inline typename std::remove_reference<_Tp>::type&&
00086 move(_Tp&& __t)
00087 { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 template<typename _Tp>
00099 inline _Tp*
00100 addressof(_Tp& __r)
00101 { return std::__addressof(__r); }
00102
00103 _GLIBCXX_END_NAMESPACE
00104
00105 #define _GLIBCXX_MOVE(__val) std::move(__val)
00106 #define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val)
00107 #else
00108 #define _GLIBCXX_MOVE(__val) (__val)
00109 #define _GLIBCXX_FORWARD(_Tp, __val) (__val)
00110 #endif
00111
00112 _GLIBCXX_BEGIN_NAMESPACE(std)
00113
00114
00115
00116
00117
00118
00119
00120
00121 template<typename _Tp>
00122 inline void
00123 swap(_Tp& __a, _Tp& __b)
00124 {
00125
00126 __glibcxx_function_requires(_SGIAssignableConcept<_Tp>)
00127
00128 _Tp __tmp = _GLIBCXX_MOVE(__a);
00129 __a = _GLIBCXX_MOVE(__b);
00130 __b = _GLIBCXX_MOVE(__tmp);
00131 }
00132
00133
00134
00135 template<typename _Tp, size_t _Nm>
00136 inline void
00137 swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
00138 {
00139 for (size_t __n = 0; __n < _Nm; ++__n)
00140 swap(__a[__n], __b[__n]);
00141 }
00142
00143 _GLIBCXX_END_NAMESPACE
00144
00145 #endif