]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/include/boost/detail/call_traits.hpp
Logo AND Algorithmique Numérique Distribuée

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