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 _GLIBCXX_CAST_H
00031 #define _GLIBCXX_CAST_H 1
00032
00033 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
00034 {
00035 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 template<typename _ToType>
00052 struct _Caster
00053 { typedef typename _ToType::element_type* type; };
00054
00055 template<typename _ToType>
00056 struct _Caster<_ToType*>
00057 { typedef _ToType* type; };
00058
00059
00060
00061
00062
00063
00064
00065
00066 template<typename _ToType, typename _FromType>
00067 inline _ToType
00068 __static_pointer_cast(const _FromType& __arg)
00069 { return _ToType(static_cast<typename _Caster<_ToType>::
00070 type>(__arg.get())); }
00071
00072 template<typename _ToType, typename _FromType>
00073 inline _ToType
00074 __dynamic_pointer_cast(const _FromType& __arg)
00075 { return _ToType(dynamic_cast<typename _Caster<_ToType>::
00076 type>(__arg.get())); }
00077
00078 template<typename _ToType, typename _FromType>
00079 inline _ToType
00080 __const_pointer_cast(const _FromType& __arg)
00081 { return _ToType(const_cast<typename _Caster<_ToType>::
00082 type>(__arg.get())); }
00083
00084 template<typename _ToType, typename _FromType>
00085 inline _ToType
00086 __reinterpret_pointer_cast(const _FromType& __arg)
00087 { return _ToType(reinterpret_cast<typename _Caster<_ToType>::
00088 type>(__arg.get())); }
00089
00090
00091
00092
00093
00094 template<typename _ToType, typename _FromType>
00095 inline _ToType
00096 __static_pointer_cast(_FromType* __arg)
00097 { return _ToType(static_cast<typename _Caster<_ToType>::
00098 type>(__arg)); }
00099
00100 template<typename _ToType, typename _FromType>
00101 inline _ToType
00102 __dynamic_pointer_cast(_FromType* __arg)
00103 { return _ToType(dynamic_cast<typename _Caster<_ToType>::
00104 type>(__arg)); }
00105
00106 template<typename _ToType, typename _FromType>
00107 inline _ToType
00108 __const_pointer_cast(_FromType* __arg)
00109 { return _ToType(const_cast<typename _Caster<_ToType>::
00110 type>(__arg)); }
00111
00112 template<typename _ToType, typename _FromType>
00113 inline _ToType
00114 __reinterpret_pointer_cast(_FromType* __arg)
00115 { return _ToType(reinterpret_cast<typename _Caster<_ToType>::
00116 type>(__arg)); }
00117
00118 _GLIBCXX_END_NAMESPACE_VERSION
00119 }
00120
00121 #endif // __GLIBCXX_CAST_H