epoc32/include/stdapis/boost/call_traits.hpp
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/call_traits.hpp	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,164 @@
     1.4 +//  (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
     1.5 +//  Use, modification and distribution are subject to the Boost Software License,
     1.6 +//  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     1.7 +//  http://www.boost.org/LICENSE_1_0.txt).
     1.8 +//
     1.9 +//  See http://www.boost.org/libs/utility for most recent version including documentation.
    1.10 +
    1.11 +// call_traits: defines typedefs for function usage
    1.12 +// (see libs/utility/call_traits.htm)
    1.13 +
    1.14 +/* Release notes:
    1.15 +   23rd July 2000:
    1.16 +      Fixed array specialization. (JM)
    1.17 +      Added Borland specific fixes for reference types
    1.18 +      (issue raised by Steve Cleary).
    1.19 +*/
    1.20 +
    1.21 +#ifndef BOOST_DETAIL_CALL_TRAITS_HPP
    1.22 +#define BOOST_DETAIL_CALL_TRAITS_HPP
    1.23 +
    1.24 +#ifndef BOOST_CONFIG_HPP
    1.25 +#include <boost/config.hpp>
    1.26 +#endif
    1.27 +#include <cstddef>
    1.28 +
    1.29 +#include <boost/type_traits/is_arithmetic.hpp>
    1.30 +#include <boost/type_traits/is_pointer.hpp>
    1.31 +#include <boost/detail/workaround.hpp>
    1.32 +
    1.33 +namespace boost{
    1.34 +
    1.35 +namespace detail{
    1.36 +
    1.37 +template <typename T, bool small_>
    1.38 +struct ct_imp2
    1.39 +{
    1.40 +   typedef const T& param_type;
    1.41 +};
    1.42 +
    1.43 +template <typename T>
    1.44 +struct ct_imp2<T, true>
    1.45 +{
    1.46 +   typedef const T param_type;
    1.47 +};
    1.48 +
    1.49 +template <typename T, bool isp, bool b1>
    1.50 +struct ct_imp
    1.51 +{
    1.52 +   typedef const T& param_type;
    1.53 +};
    1.54 +
    1.55 +template <typename T, bool isp>
    1.56 +struct ct_imp<T, isp, true>
    1.57 +{
    1.58 +   typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type;
    1.59 +};
    1.60 +
    1.61 +template <typename T, bool b1>
    1.62 +struct ct_imp<T, true, b1>
    1.63 +{
    1.64 +   typedef const T param_type;
    1.65 +};
    1.66 +
    1.67 +}
    1.68 +
    1.69 +template <typename T>
    1.70 +struct call_traits
    1.71 +{
    1.72 +public:
    1.73 +   typedef T value_type;
    1.74 +   typedef T& reference;
    1.75 +   typedef const T& const_reference;
    1.76 +   //
    1.77 +   // C++ Builder workaround: we should be able to define a compile time
    1.78 +   // constant and pass that as a single template parameter to ct_imp<T,bool>,
    1.79 +   // however compiler bugs prevent this - instead pass three bool's to
    1.80 +   // ct_imp<T,bool,bool,bool> and add an extra partial specialisation
    1.81 +   // of ct_imp to handle the logic. (JM)
    1.82 +   typedef typename boost::detail::ct_imp<
    1.83 +      T,
    1.84 +      ::boost::is_pointer<T>::value,
    1.85 +      ::boost::is_arithmetic<T>::value
    1.86 +   >::param_type param_type;
    1.87 +};
    1.88 +
    1.89 +template <typename T>
    1.90 +struct call_traits<T&>
    1.91 +{
    1.92 +   typedef T& value_type;
    1.93 +   typedef T& reference;
    1.94 +   typedef const T& const_reference;
    1.95 +   typedef T& param_type;  // hh removed const
    1.96 +};
    1.97 +
    1.98 +#if BOOST_WORKAROUND( __BORLANDC__,  BOOST_TESTED_AT( 0x581 ) )
    1.99 +// these are illegal specialisations; cv-qualifies applied to
   1.100 +// references have no effect according to [8.3.2p1],
   1.101 +// C++ Builder requires them though as it treats cv-qualified
   1.102 +// references as distinct types...
   1.103 +template <typename T>
   1.104 +struct call_traits<T&const>
   1.105 +{
   1.106 +   typedef T& value_type;
   1.107 +   typedef T& reference;
   1.108 +   typedef const T& const_reference;
   1.109 +   typedef T& param_type;  // hh removed const
   1.110 +};
   1.111 +template <typename T>
   1.112 +struct call_traits<T&volatile>
   1.113 +{
   1.114 +   typedef T& value_type;
   1.115 +   typedef T& reference;
   1.116 +   typedef const T& const_reference;
   1.117 +   typedef T& param_type;  // hh removed const
   1.118 +};
   1.119 +template <typename T>
   1.120 +struct call_traits<T&const volatile>
   1.121 +{
   1.122 +   typedef T& value_type;
   1.123 +   typedef T& reference;
   1.124 +   typedef const T& const_reference;
   1.125 +   typedef T& param_type;  // hh removed const
   1.126 +};
   1.127 +
   1.128 +template <typename T>
   1.129 +struct call_traits< T * >
   1.130 +{
   1.131 +   typedef T * value_type;
   1.132 +   typedef T * & reference;
   1.133 +   typedef T * const & const_reference;
   1.134 +   typedef T * const param_type;  // hh removed const
   1.135 +};
   1.136 +#endif
   1.137 +#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
   1.138 +template <typename T, std::size_t N>
   1.139 +struct call_traits<T [N]>
   1.140 +{
   1.141 +private:
   1.142 +   typedef T array_type[N];
   1.143 +public:
   1.144 +   // degrades array to pointer:
   1.145 +   typedef const T* value_type;
   1.146 +   typedef array_type& reference;
   1.147 +   typedef const array_type& const_reference;
   1.148 +   typedef const T* const param_type;
   1.149 +};
   1.150 +
   1.151 +template <typename T, std::size_t N>
   1.152 +struct call_traits<const T [N]>
   1.153 +{
   1.154 +private:
   1.155 +   typedef const T array_type[N];
   1.156 +public:
   1.157 +   // degrades array to pointer:
   1.158 +   typedef const T* value_type;
   1.159 +   typedef array_type& reference;
   1.160 +   typedef const array_type& const_reference;
   1.161 +   typedef const T* const param_type;
   1.162 +};
   1.163 +#endif
   1.164 +
   1.165 +}
   1.166 +
   1.167 +#endif // BOOST_DETAIL_CALL_TRAITS_HPP