src/sysc/packages/boost/detail/call_traits.hpp

Go to the documentation of this file.
00001 //  (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
00002 //  Permission to copy, use, modify, sell and
00003 //  distribute this software is granted provided this copyright notice appears
00004 //  in all copies. This software is provided "as is" without express or implied
00005 //  warranty, and with no claim as to its suitability for any purpose.
00006 
00007 //  See http://www.boost.org for most recent version including documentation.
00008 
00009 // call_traits: defines typedefs for function usage
00010 // (see libs/utility/call_traits.htm)
00011 
00012 /* Release notes:
00013    23rd July 2000:
00014       Fixed array specialization. (JM)
00015       Added Borland specific fixes for reference types
00016       (issue raised by Steve Cleary).
00017 */
00018 
00019 #ifndef BOOST_DETAIL_CALL_TRAITS_HPP
00020 #define BOOST_DETAIL_CALL_TRAITS_HPP
00021 
00022 #ifndef BOOST_CONFIG_HPP
00023 #include <sysc/packages/boost/config.hpp>
00024 #endif
00025 
00026 #ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP
00027 #include <sysc/packages/boost/type_traits/arithmetic_traits.hpp>
00028 #endif
00029 #ifndef BOOST_COMPOSITE_TYPE_TRAITS_HPP
00030 #include <sysc/packages/boost/type_traits/composite_traits.hpp>
00031 #endif
00032 
00033 namespace boost{
00034 
00035 namespace detail{
00036 
00037 template <typename T, bool small_>
00038 struct ct_imp2
00039 {
00040    typedef const T& param_type;
00041 };
00042 
00043 template <typename T>
00044 struct ct_imp2<T, true>
00045 {
00046    typedef const T param_type;
00047 };
00048 
00049 template <typename T, bool isp, bool b1>
00050 struct ct_imp
00051 {
00052    typedef const T& param_type;
00053 };
00054 
00055 template <typename T, bool isp>
00056 struct ct_imp<T, isp, true>
00057 {
00058    typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type;
00059 };
00060 
00061 template <typename T, bool b1>
00062 struct ct_imp<T, true, b1>
00063 {
00064    typedef T const param_type;
00065 };
00066 
00067 }
00068 
00069 template <typename T>
00070 struct call_traits
00071 {
00072 public:
00073    typedef T value_type;
00074    typedef T& reference;
00075    typedef const T& const_reference;
00076    //
00077    // C++ Builder workaround: we should be able to define a compile time
00078    // constant and pass that as a single template parameter to ct_imp<T,bool>,
00079    // however compiler bugs prevent this - instead pass three bool's to
00080    // ct_imp<T,bool,bool,bool> and add an extra partial specialisation
00081    // of ct_imp to handle the logic. (JM)
00082    typedef typename detail::ct_imp<
00083       T,
00084       ::boost::is_pointer<T>::value,
00085       ::boost::is_arithmetic<T>::value
00086    >::param_type param_type;
00087 };
00088 
00089 template <typename T>
00090 struct call_traits<T&>
00091 {
00092    typedef T& value_type;
00093    typedef T& reference;
00094    typedef const T& const_reference;
00095    typedef T& param_type;  // hh removed const
00096 };
00097 
00098 #if defined(__BORLANDC__) && (__BORLANDC__ <= 0x560)
00099 // these are illegal specialisations; cv-qualifies applied to
00100 // references have no effect according to [8.3.2p1],
00101 // C++ Builder requires them though as it treats cv-qualified
00102 // references as distinct types...
00103 template <typename T>
00104 struct call_traits<T&const>
00105 {
00106    typedef T& value_type;
00107    typedef T& reference;
00108    typedef const T& const_reference;
00109    typedef T& param_type;  // hh removed const
00110 };
00111 template <typename T>
00112 struct call_traits<T&volatile>
00113 {
00114    typedef T& value_type;
00115    typedef T& reference;
00116    typedef const T& const_reference;
00117    typedef T& param_type;  // hh removed const
00118 };
00119 template <typename T>
00120 struct call_traits<T&const volatile>
00121 {
00122    typedef T& value_type;
00123    typedef T& reference;
00124    typedef const T& const_reference;
00125    typedef T& param_type;  // hh removed const
00126 };
00127 #endif
00128 #ifndef __SUNPRO_CC
00129 template <typename T, std::size_t N>
00130 struct call_traits<T [N]>
00131 {
00132 private:
00133    typedef T array_type[N];
00134 public:
00135    // degrades array to pointer:
00136    typedef const T* value_type;
00137    typedef array_type& reference;
00138    typedef const array_type& const_reference;
00139    typedef const T* const param_type;
00140 };
00141 
00142 template <typename T, std::size_t N>
00143 struct call_traits<const T [N]>
00144 {
00145 private:
00146    typedef const T array_type[N];
00147 public:
00148    // degrades array to pointer:
00149    typedef const T* value_type;
00150    typedef array_type& reference;
00151    typedef const array_type& const_reference;
00152    typedef const T* const param_type;
00153 };
00154 #endif
00155 
00156 }
00157 
00158 #endif // BOOST_DETAIL_CALL_TRAITS_HPP

Generated on Wed Apr 25 13:53:28 2007 for SystemC by  doxygen 1.5.1