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)
9 #ifndef BOOST_CLBL_TRTS_DETAIL_FUNCTION_HPP
10 #define BOOST_CLBL_TRTS_DETAIL_FUNCTION_HPP
12 #include <boost/callable_traits/detail/config.hpp>
13 #include <boost/callable_traits/detail/qualifier_flags.hpp>
14 #include <boost/callable_traits/detail/forward_declarations.hpp>
15 #include <boost/callable_traits/detail/set_function_qualifiers.hpp>
16 #include <boost/callable_traits/detail/default_callable_traits.hpp>
18 namespace boost { namespace callable_traits { namespace detail {
21 struct function : default_callable_traits<T> {};
23 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
24 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
25 #include <boost/callable_traits/detail/unguarded/function.hpp>
26 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
28 #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
30 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS const
31 #include <boost/callable_traits/detail/unguarded/function.hpp>
32 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
34 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS volatile
35 #include <boost/callable_traits/detail/unguarded/function.hpp>
36 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
38 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS const volatile
39 #include <boost/callable_traits/detail/unguarded/function.hpp>
40 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
42 #ifndef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
44 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS &
45 #include <boost/callable_traits/detail/unguarded/function.hpp>
46 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
48 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS &&
49 #include <boost/callable_traits/detail/unguarded/function.hpp>
50 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
52 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS const &
53 #include <boost/callable_traits/detail/unguarded/function.hpp>
54 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
56 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS const &&
57 #include <boost/callable_traits/detail/unguarded/function.hpp>
58 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
60 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS volatile &
61 #include <boost/callable_traits/detail/unguarded/function.hpp>
62 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
64 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS volatile &&
65 #include <boost/callable_traits/detail/unguarded/function.hpp>
66 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
68 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS const volatile &
69 #include <boost/callable_traits/detail/unguarded/function.hpp>
70 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
72 #define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS const volatile &&
73 #include <boost/callable_traits/detail/unguarded/function.hpp>
74 #undef BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
76 #endif // #ifndef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
77 #endif // #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
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
85 #include <boost/callable_traits/detail/unguarded/function_ptr.hpp>
86 #include <boost/callable_traits/detail/unguarded/function_ptr_varargs.hpp>
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
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
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
110 #include <boost/callable_traits/detail/unguarded/function_ptr.hpp>
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
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
122 #include <boost/callable_traits/detail/unguarded/function_ptr.hpp>
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
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
134 #include <boost/callable_traits/detail/unguarded/function_ptr.hpp>
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
142 struct function<T&> : std::conditional<function<T>::value,
143 function<T>, default_callable_traits<T&>>::type {
145 static constexpr const bool value = !std::is_pointer<T>::value;
147 using traits = function;
148 using base = function<T>;
150 using remove_varargs = typename base::remove_varargs&;
151 using add_varargs = typename base::add_varargs&;
153 using remove_member_reference = reference_error;
154 using add_member_lvalue_reference = reference_error;
155 using add_member_rvalue_reference = reference_error;
156 using add_member_const = reference_error;
157 using add_member_volatile = reference_error;
158 using add_member_cv = reference_error;
159 using remove_member_const = reference_error;
160 using remove_member_volatile = reference_error;
161 using remove_member_cv = reference_error;
163 template<typename NewReturn>
164 using apply_return = typename base::template apply_return<NewReturn>&;
166 using clear_args = typename base::clear_args&;
168 template<typename... NewArgs>
169 using push_front = typename base::template push_front<NewArgs...>&;
171 template<typename... NewArgs>
172 using push_back = typename base::template push_back<NewArgs...>&;
174 template<std::size_t Count>
175 using pop_back = typename base::template pop_back<Count>&;
177 template<std::size_t Count>
178 using pop_front = typename base::template pop_front<Count>&;
180 template<std::size_t Index, typename... NewArgs>
181 using insert_args = typename base::template insert_args<Index, NewArgs...>&;
183 template<std::size_t Index, std::size_t Count>
184 using remove_args = typename base::template remove_args<Index, Count>&;
186 template<std::size_t Index, typename... NewArgs>
187 using replace_args = typename base::template replace_args<Index, NewArgs...>&;
190 }}} // namespace boost::callable_traits::detail
192 #endif // #ifndef BOOST_CLBL_TRTS_DETAIL_FUNCTION_HPP