00001 #ifndef DVUTIL_BASETYPE_H 00002 #define DVUTIL_BASETYPE_H 00003 // $Id: basetype.h,v 1.2 2008/03/14 21:44:10 dvermeir Exp $ 00004 00005 namespace Dv { 00006 /** @defgroup basetype Retrieve the base component of a type. 00007 * @{ 00008 * Retrieve the base component of a type. 00009 * A class template with specialisation that support th 00010 * retrieval of the 'base type' of a type, i.e. the 00011 * type with the qualifiers 'const' '&' removed. 00012 * 00013 * E.g all the types below are 'int' 00014 * @code 00015 * basetype<int>::base 00016 * basetype<const int>::base 00017 * basetype<int&>::base 00018 * basetype<const int&>::base 00019 * @endcode 00020 * @warning 00021 * Could be extended to also remove '*'. 00022 */ 00023 /** Retrieve the base component of a type. 00024 * A class template with specialisation that support th 00025 * retrieval of the 'base type' of a type, i.e. the 00026 * type with the qualifiers 'const' '&' removed. 00027 * 00028 * E.g all the types below are 'int' 00029 * @code 00030 * basetype<int>::base 00031 * basetype<const int>::base 00032 * basetype<int&>::base 00033 * basetype<const int&>::base 00034 * @endcode 00035 * @warning 00036 * Could be extended to also remove '*'. 00037 */ 00038 template<typename T> 00039 struct basetype { 00040 typedef T base; 00041 }; 00042 00043 /** Retrieve the base component of a type. 00044 * A class template with specialisation that support th 00045 * retrieval of the 'base type' of a type, i.e. the 00046 * type with the qualifiers 'const' '&' removed. 00047 * 00048 * E.g all the types below are 'int' 00049 * @code 00050 * basetype<int>::base 00051 * basetype<const int>::base 00052 * basetype<int&>::base 00053 * basetype<const int&>::base 00054 * @endcode 00055 * @warning 00056 * Could be extended to also remove '*'. 00057 */ 00058 template<typename T> 00059 struct basetype<T&> { 00060 typedef T base; 00061 }; 00062 00063 /** Retrieve the base component of a type. 00064 * A class template with specialisation that support th 00065 * retrieval of the 'base type' of a type, i.e. the 00066 * type with the qualifiers 'const' '&' removed. 00067 * 00068 * E.g all the types below are 'int' 00069 * @code 00070 * basetype<int>::base 00071 * basetype<const int>::base 00072 * basetype<int&>::base 00073 * basetype<const int&>::base 00074 * @endcode 00075 * @warning 00076 * Could be extended to also remove '*'. 00077 */ 00078 template<typename T> 00079 struct basetype<const T&> { 00080 typedef T base; 00081 }; 00082 00083 /** Retrieve the base component of a type. 00084 * A class template with specialisation that support the 00085 * retrieval of the 'base type' of a type, i.e. the 00086 * type with the qualifiers 'const' '&' removed. 00087 * 00088 * E.g all the types below are 'int' 00089 * @code 00090 * basetype<int>::base 00091 * basetype<const int>::base 00092 * basetype<int&>::base 00093 * basetype<const int&>::base 00094 * @endcode 00095 * @warning 00096 * Could be extended to also remove '*'. 00097 */ 00098 template<typename T> 00099 struct basetype<const T> { 00100 typedef T base; 00101 }; 00102 /** @} */ 00103 } 00104 #endif
dvutil-1.0.10 | [ 5 December, 2009] |