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 template<typename _Tp>
00056 struct identity
00057 {
00058 typedef _Tp type;
00059 };
00060
00061
00062
00063 template<typename _Tp>
00064 inline typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp&&>::type
00065 forward(typename std::identity<_Tp>::type& __t)
00066 { return static_cast<_Tp&&>(__t); }
00067
00068
00069 template<typename _Tp>
00070 inline typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp&&>::type
00071 forward(typename std::identity<_Tp>::type&& __t)
00072 { return static_cast<_Tp&&>(__t); }
00073
00074
00075 template<typename _Tp>
00076 inline typename enable_if<is_lvalue_reference<_Tp>::value, _Tp>::type
00077 forward(typename std::identity<_Tp>::type __t)
00078 { return __t; }
00079
00080
00081 template<typename _Tp>
00082 inline typename enable_if<is_lvalue_reference<_Tp>::value, _Tp>::type
00083 forward(typename std::remove_reference<_Tp>::type&& __t) = delete;
00084
00085
00086
00087
00088
00089
00090
00091 template<typename _Tp>
00092 inline typename std::remove_reference<_Tp>::type&&
00093 move(_Tp&& __t)
00094 { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 template<typename _Tp>
00106 inline _Tp*
00107 addressof(_Tp& __r)
00108 { return std::__addressof(__r); }
00109
00110 _GLIBCXX_END_NAMESPACE
00111
00112 #define _GLIBCXX_MOVE(_Tp) std::move(_Tp)
00113 #define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val)
00114 #else
00115 #define _GLIBCXX_MOVE(_Tp) (_Tp)
00116 #define _GLIBCXX_FORWARD(_Tp, __val) (__val)
00117 #endif
00118
00119 _GLIBCXX_BEGIN_NAMESPACE(std)
00120
00121
00122
00123
00124
00125
00126
00127
00128 template<typename _Tp>
00129 inline void
00130 swap(_Tp& __a, _Tp& __b)
00131 {
00132
00133 __glibcxx_function_requires(_SGIAssignableConcept<_Tp>)
00134
00135 _Tp __tmp = _GLIBCXX_MOVE(__a);
00136 __a = _GLIBCXX_MOVE(__b);
00137 __b = _GLIBCXX_MOVE(__tmp);
00138 }
00139
00140
00141
00142 template<typename _Tp, size_t _Nm>
00143 inline void
00144 swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
00145 {
00146 for (size_t __n = 0; __n < _Nm; ++__n)
00147 swap(__a[__n], __b[__n]);
00148 }
00149
00150 _GLIBCXX_END_NAMESPACE
00151
00152 #endif