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 #ifndef BOOST_DETAIL_CALL_TRAITS_HPP
00019 #define BOOST_DETAIL_CALL_TRAITS_HPP
00020
00021 #ifndef BOOST_CONFIG_HPP
00022 #include <boost/config.hpp>
00023 #endif
00024 #include <cstddef>
00025
00026 #include <boost/type_traits/is_arithmetic.hpp>
00027 #include <boost/type_traits/is_pointer.hpp>
00028 #include <boost/detail/workaround.hpp>
00029
00030 namespace boost{
00031
00032 namespace detail{
00033
00034 template <typename T, bool small_>
00035 struct ct_imp2
00036 {
00037 typedef const T& param_type;
00038 };
00039
00040 template <typename T>
00041 struct ct_imp2<T, true>
00042 {
00043 typedef const T param_type;
00044 };
00045
00046 template <typename T, bool isp, bool b1>
00047 struct ct_imp
00048 {
00049 typedef const T& param_type;
00050 };
00051
00052 template <typename T, bool isp>
00053 struct ct_imp<T, isp, true>
00054 {
00055 typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type;
00056 };
00057
00058 template <typename T, bool b1>
00059 struct ct_imp<T, true, b1>
00060 {
00061 typedef const T param_type;
00062 };
00063
00064 }
00065
00066 template <typename T>
00067 struct call_traits
00068 {
00069 public:
00070 typedef T value_type;
00071 typedef T& reference;
00072 typedef const T& const_reference;
00073
00074
00075
00076
00077
00078
00079 typedef typename boost::detail::ct_imp<
00080 T,
00081 ::boost::is_pointer<T>::value,
00082 ::boost::is_arithmetic<T>::value
00083 >::param_type param_type;
00084 };
00085
00086 template <typename T>
00087 struct call_traits<T&>
00088 {
00089 typedef T& value_type;
00090 typedef T& reference;
00091 typedef const T& const_reference;
00092 typedef T& param_type;
00093 };
00094
00095 #if BOOST_WORKAROUND( __BORLANDC__, < 0x5A0 )
00096
00097
00098
00099
00100 template <typename T>
00101 struct call_traits<T&const>
00102 {
00103 typedef T& value_type;
00104 typedef T& reference;
00105 typedef const T& const_reference;
00106 typedef T& param_type;
00107 };
00108 template <typename T>
00109 struct call_traits<T&volatile>
00110 {
00111 typedef T& value_type;
00112 typedef T& reference;
00113 typedef const T& const_reference;
00114 typedef T& param_type;
00115 };
00116 template <typename T>
00117 struct call_traits<T&const volatile>
00118 {
00119 typedef T& value_type;
00120 typedef T& reference;
00121 typedef const T& const_reference;
00122 typedef T& param_type;
00123 };
00124
00125 template <typename T>
00126 struct call_traits< T * >
00127 {
00128 typedef T * value_type;
00129 typedef T * & reference;
00130 typedef T * const & const_reference;
00131 typedef T * const param_type;
00132 };
00133 #endif
00134 #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
00135 template <typename T, std::size_t N>
00136 struct call_traits<T [N]>
00137 {
00138 private:
00139 typedef T array_type[N];
00140 public:
00141
00142 typedef const T* value_type;
00143 typedef array_type& reference;
00144 typedef const array_type& const_reference;
00145 typedef const T* const param_type;
00146 };
00147
00148 template <typename T, std::size_t N>
00149 struct call_traits<const T [N]>
00150 {
00151 private:
00152 typedef const T array_type[N];
00153 public:
00154
00155 typedef const T* value_type;
00156 typedef array_type& reference;
00157 typedef const array_type& const_reference;
00158 typedef const T* const param_type;
00159 };
00160 #endif
00161
00162 }
00163
00164 #endif // BOOST_DETAIL_CALL_TRAITS_HPP