annotate DEPENDENCIES/generic/include/boost/detail/call_traits.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
Chris@16 2 // Use, modification and distribution are subject to the Boost Software License,
Chris@16 3 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 4 // http://www.boost.org/LICENSE_1_0.txt).
Chris@16 5 //
Chris@16 6 // See http://www.boost.org/libs/utility for most recent version including documentation.
Chris@16 7
Chris@16 8 // call_traits: defines typedefs for function usage
Chris@16 9 // (see libs/utility/call_traits.htm)
Chris@16 10
Chris@16 11 /* Release notes:
Chris@16 12 23rd July 2000:
Chris@16 13 Fixed array specialization. (JM)
Chris@16 14 Added Borland specific fixes for reference types
Chris@16 15 (issue raised by Steve Cleary).
Chris@16 16 */
Chris@16 17
Chris@16 18 #ifndef BOOST_DETAIL_CALL_TRAITS_HPP
Chris@16 19 #define BOOST_DETAIL_CALL_TRAITS_HPP
Chris@16 20
Chris@16 21 #ifndef BOOST_CONFIG_HPP
Chris@16 22 #include <boost/config.hpp>
Chris@16 23 #endif
Chris@16 24 #include <cstddef>
Chris@16 25
Chris@16 26 #include <boost/type_traits/is_arithmetic.hpp>
Chris@16 27 #include <boost/type_traits/is_enum.hpp>
Chris@16 28 #include <boost/type_traits/is_pointer.hpp>
Chris@16 29 #include <boost/detail/workaround.hpp>
Chris@16 30
Chris@16 31 namespace boost{
Chris@16 32
Chris@16 33 namespace detail{
Chris@16 34
Chris@16 35 template <typename T, bool small_>
Chris@16 36 struct ct_imp2
Chris@16 37 {
Chris@16 38 typedef const T& param_type;
Chris@16 39 };
Chris@16 40
Chris@16 41 template <typename T>
Chris@16 42 struct ct_imp2<T, true>
Chris@16 43 {
Chris@16 44 typedef const T param_type;
Chris@16 45 };
Chris@16 46
Chris@16 47 template <typename T, bool isp, bool b1, bool b2>
Chris@16 48 struct ct_imp
Chris@16 49 {
Chris@16 50 typedef const T& param_type;
Chris@16 51 };
Chris@16 52
Chris@16 53 template <typename T, bool isp, bool b2>
Chris@16 54 struct ct_imp<T, isp, true, b2>
Chris@16 55 {
Chris@16 56 typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type;
Chris@16 57 };
Chris@16 58
Chris@16 59 template <typename T, bool isp, bool b1>
Chris@16 60 struct ct_imp<T, isp, b1, true>
Chris@16 61 {
Chris@16 62 typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type;
Chris@16 63 };
Chris@16 64
Chris@16 65 template <typename T, bool b1, bool b2>
Chris@16 66 struct ct_imp<T, true, b1, b2>
Chris@16 67 {
Chris@16 68 typedef const T param_type;
Chris@16 69 };
Chris@16 70
Chris@16 71 }
Chris@16 72
Chris@16 73 template <typename T>
Chris@16 74 struct call_traits
Chris@16 75 {
Chris@16 76 public:
Chris@16 77 typedef T value_type;
Chris@16 78 typedef T& reference;
Chris@16 79 typedef const T& const_reference;
Chris@16 80 //
Chris@16 81 // C++ Builder workaround: we should be able to define a compile time
Chris@16 82 // constant and pass that as a single template parameter to ct_imp<T,bool>,
Chris@16 83 // however compiler bugs prevent this - instead pass three bool's to
Chris@16 84 // ct_imp<T,bool,bool,bool> and add an extra partial specialisation
Chris@16 85 // of ct_imp to handle the logic. (JM)
Chris@16 86 typedef typename boost::detail::ct_imp<
Chris@16 87 T,
Chris@16 88 ::boost::is_pointer<T>::value,
Chris@16 89 ::boost::is_arithmetic<T>::value,
Chris@16 90 ::boost::is_enum<T>::value
Chris@16 91 >::param_type param_type;
Chris@16 92 };
Chris@16 93
Chris@16 94 template <typename T>
Chris@16 95 struct call_traits<T&>
Chris@16 96 {
Chris@16 97 typedef T& value_type;
Chris@16 98 typedef T& reference;
Chris@16 99 typedef const T& const_reference;
Chris@16 100 typedef T& param_type; // hh removed const
Chris@16 101 };
Chris@16 102
Chris@16 103 #if BOOST_WORKAROUND( __BORLANDC__, < 0x5A0 )
Chris@16 104 // these are illegal specialisations; cv-qualifies applied to
Chris@16 105 // references have no effect according to [8.3.2p1],
Chris@16 106 // C++ Builder requires them though as it treats cv-qualified
Chris@16 107 // references as distinct types...
Chris@16 108 template <typename T>
Chris@16 109 struct call_traits<T&const>
Chris@16 110 {
Chris@16 111 typedef T& value_type;
Chris@16 112 typedef T& reference;
Chris@16 113 typedef const T& const_reference;
Chris@16 114 typedef T& param_type; // hh removed const
Chris@16 115 };
Chris@16 116 template <typename T>
Chris@16 117 struct call_traits<T&volatile>
Chris@16 118 {
Chris@16 119 typedef T& value_type;
Chris@16 120 typedef T& reference;
Chris@16 121 typedef const T& const_reference;
Chris@16 122 typedef T& param_type; // hh removed const
Chris@16 123 };
Chris@16 124 template <typename T>
Chris@16 125 struct call_traits<T&const volatile>
Chris@16 126 {
Chris@16 127 typedef T& value_type;
Chris@16 128 typedef T& reference;
Chris@16 129 typedef const T& const_reference;
Chris@16 130 typedef T& param_type; // hh removed const
Chris@16 131 };
Chris@16 132
Chris@16 133 template <typename T>
Chris@16 134 struct call_traits< T * >
Chris@16 135 {
Chris@16 136 typedef T * value_type;
Chris@16 137 typedef T * & reference;
Chris@16 138 typedef T * const & const_reference;
Chris@16 139 typedef T * const param_type; // hh removed const
Chris@16 140 };
Chris@16 141 #endif
Chris@16 142 #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
Chris@16 143 template <typename T, std::size_t N>
Chris@16 144 struct call_traits<T [N]>
Chris@16 145 {
Chris@16 146 private:
Chris@16 147 typedef T array_type[N];
Chris@16 148 public:
Chris@16 149 // degrades array to pointer:
Chris@16 150 typedef const T* value_type;
Chris@16 151 typedef array_type& reference;
Chris@16 152 typedef const array_type& const_reference;
Chris@16 153 typedef const T* const param_type;
Chris@16 154 };
Chris@16 155
Chris@16 156 template <typename T, std::size_t N>
Chris@16 157 struct call_traits<const T [N]>
Chris@16 158 {
Chris@16 159 private:
Chris@16 160 typedef const T array_type[N];
Chris@16 161 public:
Chris@16 162 // degrades array to pointer:
Chris@16 163 typedef const T* value_type;
Chris@16 164 typedef array_type& reference;
Chris@16 165 typedef const array_type& const_reference;
Chris@16 166 typedef const T* const param_type;
Chris@16 167 };
Chris@16 168 #endif
Chris@16 169
Chris@16 170 }
Chris@16 171
Chris@16 172 #endif // BOOST_DETAIL_CALL_TRAITS_HPP