function.hpp
Go to the documentation of this file.
1 /*
2 
3 @Copyright Barrett Adair 2015-2017
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
6 
7 */
8 
9 #ifndef BOOST_CLBL_TRTS_DETAIL_FUNCTION_HPP
10 #define BOOST_CLBL_TRTS_DETAIL_FUNCTION_HPP
11 
17 
18 namespace boost { namespace callable_traits { namespace detail {
19 
20 template<typename T>
22 
23 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
24 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
26 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
27 
28 #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
29 
30 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS const
32 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
33 
34 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS volatile
36 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
37 
38 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS const volatile
40 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
41 
42 #ifndef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
43 
44 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS &
46 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
47 
48 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS &&
50 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
51 
52 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS const &
54 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
55 
56 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS const &&
58 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
59 
60 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS volatile &
62 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
63 
64 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS volatile &&
66 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
67 
68 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS const volatile &
70 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
71 
72 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS const volatile &&
74 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
75 
76 #endif // #ifndef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
77 #endif // #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
78 
79 // function pointers
80 
81 #define BOOST_CLBL_TRTS_CC_TAG dummy
82 #define BOOST_CLBL_TRTS_VARARGS_CC BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
83 #define BOOST_CLBL_TRTS_CC
84 #define BOOST_CLBL_TRTS_ST
87 #undef BOOST_CLBL_TRTS_ST
88 #undef BOOST_CLBL_TRTS_CC
89 #undef BOOST_CLBL_TRTS_CC_TAG
90 #undef BOOST_CLBL_TRTS_VARARGS_CC
91 
92 /* ?
93 #ifdef BOOST_CLBL_TRTS_ENABLE_CDECL
94 #define BOOST_CLBL_TRTS_CC_TAG cdecl_tag
95 #define BOOST_CLBL_TRTS_VARARGS_CC __cdecl
96 #define BOOST_CLBL_TRTS_CC __cdecl
97 #define BOOST_CLBL_TRTS_ST
98 #include <boost/callable_traits/detail/unguarded/function_ptr.hpp>
99 #undef BOOST_CLBL_TRTS_ST
100 #undef BOOST_CLBL_TRTS_CC
101 #undef BOOST_CLBL_TRTS_CC_TAG
102 #undef BOOST_CLBL_TRTS_VARARGS_CC
103 #endif*/
104 
105 #ifdef BOOST_CLBL_TRTS_ENABLE_STDCALL
106 #define BOOST_CLBL_TRTS_CC_TAG stdcall_tag
107 #define BOOST_CLBL_TRTS_VARARGS_CC BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
108 #define BOOST_CLBL_TRTS_CC __stdcall
109 #define BOOST_CLBL_TRTS_ST
111 #undef BOOST_CLBL_TRTS_ST
112 #undef BOOST_CLBL_TRTS_CC
113 #undef BOOST_CLBL_TRTS_CC_TAG
114 #undef BOOST_CLBL_TRTS_VARARGS_CC
115 #endif
116 
117 #ifdef BOOST_CLBL_TRTS_ENABLE_FASTCALL
118 #define BOOST_CLBL_TRTS_CC_TAG fastcall_tag
119 #define BOOST_CLBL_TRTS_VARARGS_CC BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
120 #define BOOST_CLBL_TRTS_CC __fastcall
121 #define BOOST_CLBL_TRTS_ST
123 #undef BOOST_CLBL_TRTS_CC
124 #undef BOOST_CLBL_TRTS_ST
125 #undef BOOST_CLBL_TRTS_CC_TAG
126 #undef BOOST_CLBL_TRTS_VARARGS_CC
127 #endif
128 
129 #ifdef BOOST_CLBL_TRTS_ENABLE_PASCAL
130 #define BOOST_CLBL_TRTS_CC_TAG pascal_tag
131 #define BOOST_CLBL_TRTS_VARARGS_CC BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
132 #define BOOST_CLBL_TRTS_CC
133 #define BOOST_CLBL_TRTS_ST pascal
135 #undef BOOST_CLBL_TRTS_CC
136 #undef BOOST_CLBL_TRTS_ST
137 #undef BOOST_CLBL_TRTS_CC_TAG
138 #undef BOOST_CLBL_TRTS_VARARGS_CC
139 #endif
140 
141 template<typename T>
142 struct function<T&> : std::conditional<function<T>::value,
144 
145  static constexpr const bool value = !std::is_pointer<T>::value;
146 
147  using traits = function;
148  using base = function<T>;
149  using type = T&;
151  using add_varargs = typename base::add_varargs&;
152 
162 
163  template<typename NewReturn>
164  using apply_return = typename base::template apply_return<NewReturn>&;
165 
166  using clear_args = typename base::clear_args&;
167 
168  template<typename... NewArgs>
169  using push_front = typename base::template push_front<NewArgs...>&;
170 
171  template<typename... NewArgs>
172  using push_back = typename base::template push_back<NewArgs...>&;
173 
174  template<std::size_t Count>
175  using pop_back = typename base::template pop_back<Count>&;
176 
177  template<std::size_t Count>
178  using pop_front = typename base::template pop_front<Count>&;
179 
180  template<std::size_t Index, typename... NewArgs>
181  using insert_args = typename base::template insert_args<Index, NewArgs...>&;
182 
183  template<std::size_t Index, std::size_t Count>
184  using remove_args = typename base::template remove_args<Index, Count>&;
185 
186  template<std::size_t Index, typename... NewArgs>
187  using replace_args = typename base::template replace_args<Index, NewArgs...>&;
188 };
189 
190 }}} // namespace boost::callable_traits::detail
191 
192 #endif // #ifndef BOOST_CLBL_TRTS_DETAIL_FUNCTION_HPP
typename base::add_varargs & add_varargs
Definition: function.hpp:151
typename base::template push_front< NewArgs... > & push_front
Definition: function.hpp:169
typename base::template replace_args< Index, NewArgs... > & replace_args
Definition: function.hpp:187
typename base::template push_back< NewArgs... > & push_back
Definition: function.hpp:172
typename base::template pop_front< Count > & pop_front
Definition: function.hpp:178
typename base::template apply_return< NewReturn > & apply_return
Definition: function.hpp:164
typename base::remove_varargs & remove_varargs
Definition: function.hpp:150
typename base::template pop_back< Count > & pop_back
Definition: function.hpp:175
typename base::clear_args & clear_args
Definition: function.hpp:166
typename base::template remove_args< Index, Count > & remove_args
Definition: function.hpp:184
typename base::template insert_args< Index, NewArgs... > & insert_args
Definition: function.hpp:181