function_3.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2016 Barrett Adair
3 
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 HEADER GUARDS INTENTIONALLY OMITTED
8 DO NOT INCLUDE THIS HEADER DIRECTLY
9 
10 macros used:
11 
12 BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS - the function-level qualifiers for the
13  current inclusion (combinations of `const` `volatile` `&` `&&`, or nothing)
14 
15 BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE - the transaction_safe specifier for
16  the current include (`transaction_safe` or nothing)
17 
18 BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE - `std::true_type` or `std::false_type`,
19  tied on whether BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE is `transaction_safe`
20 
21 BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER - `transaction_safe` when
22  BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE is enabled, otherwise nothing
23 
24 BOOST_CLBL_TRTS_NOEXCEPT_SPEC - the noexcept specifier for
25  the current include (`noexcept` or nothing)
26 
27 BOOST_CLBL_TRTS_IS_NOEXCEPT - `std::true_type` or `std::false_type`,
28  tied on whether BOOST_CLBL_TRTS_NOEXCEPT_SPEC is `noexcept`
29 
30 BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER - `noexcept` if
31  BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES is defined, otherwise nothing
32 
33 */
34 
35 template<typename Return, typename... Args>
36 struct function<Return(Args...)
40  : default_callable_traits<dummy BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS> {
41 
42  static constexpr bool value = true;
43 
44  using traits = function;
45 
46  using return_type = Return;
47 
48  using arg_types = std::tuple<Args...>;
50 
51  using type = Return(Args...)
55 
56  using function_type = Return(Args...);
57 
58  using qualified_function_type = Return(Args...)
62 
64 
65  using add_varargs = Return (Args..., ...)
69 
71 
72  using remove_noexcept = Return(Args...)
75 
76  using add_noexcept = Return(Args...)
80 
82 
83  using remove_transaction_safe = Return(Args...)
86 
87  using add_transaction_safe = Return(Args...)
91 
92  using qualifiers = default_callable_traits<dummy BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>;
93 
94  template<qualifier_flags Flags>
96  is_noexcept::value, Return, Args...>;
97 
98  #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
99 
100  using add_member_lvalue_reference = abominable_functions_not_supported_on_this_compiler;
101  using add_member_rvalue_reference = abominable_functions_not_supported_on_this_compiler;
102  using add_member_const = abominable_functions_not_supported_on_this_compiler;
103  using add_member_volatile = abominable_functions_not_supported_on_this_compiler;
104  using add_member_cv = abominable_functions_not_supported_on_this_compiler;
105 
106  #else
107 
109  collapse_flags<qualifiers::q_flags, lref_>::value>;
110 
112  collapse_flags<qualifiers::q_flags, rref_>::value>;
113 
115 
117 
119 
120  #endif // #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
121 
123 
125  qualifiers::ref_flags | remove_const_flag<qualifiers::cv_flags>::value>;
126 
128  qualifiers::ref_flags | remove_volatile_flag<qualifiers::cv_flags>::value>;
129 
131 
132  template<typename U>
133  using apply_member_pointer = add_member_pointer<type, U>;
134 
135  template<typename NewReturn>
136  using apply_return = NewReturn(Args...)
140 
141  template<template<class...> class Container>
142  using expand_args = Container<Args...>;
143 
144  using is_member_pointer = std::false_type;
145 };
146 
147 
148 template<typename Return, typename... Args>
149 struct function<Return (Args..., ...)
153  : default_callable_traits<dummy BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS> {
154 
155  static constexpr bool value = true;
156 
157  using has_varargs = std::true_type;
158  using traits = function;
159  using return_type = Return;
160  using arg_types = std::tuple<Args...>;
161 
162  using type = Return (Args..., ...)
166 
167  using function_type = Return(Args..., ...);
168 
169  using qualified_function_type = Return(Args..., ...)
173 
174  using remove_varargs = Return (Args...)
178 
179  using add_varargs = type;
180 
182 
183  using remove_noexcept = Return(Args..., ...)
186 
187  using add_noexcept = Return(Args..., ...)
191 
193 
194  using remove_transaction_safe = Return(Args..., ...)
197 
198  using add_transaction_safe = Return(Args..., ...)
202 
203  using qualifiers = default_callable_traits<dummy BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>;
204 
205  template<qualifier_flags Flags>
207  is_noexcept::value, Return, Args...>;
208 
209  #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
210 
211  using add_member_lvalue_reference = abominable_functions_not_supported_on_this_compiler;
212  using add_member_rvalue_reference = abominable_functions_not_supported_on_this_compiler;
213  using add_member_const = abominable_functions_not_supported_on_this_compiler;
214  using add_member_volatile = abominable_functions_not_supported_on_this_compiler;
215  using add_member_cv = abominable_functions_not_supported_on_this_compiler;
216 
217  #else
218 
220  collapse_flags<qualifiers::q_flags, lref_>::value>;
221 
223  collapse_flags<qualifiers::q_flags, rref_>::value>;
224 
226 
228 
230 
231  #endif // #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
232 
234 
236  qualifiers::ref_flags | remove_const_flag<qualifiers::cv_flags>::value>;
237 
239  qualifiers::ref_flags | remove_volatile_flag<qualifiers::cv_flags>::value>;
240 
242 
243  template<typename U>
245  Return( BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC U::*)(Args..., ...)
249 
250  template<typename NewReturn>
251  using apply_return = NewReturn(Args..., ...)
255 
256  template<template<class...> class Container>
257  using expand_args = Container<Args...>;
258 
259  using is_member_pointer = std::false_type;
260 };
#define BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
Definition: config.hpp:87
#define BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER
Definition: config.hpp:37
#define BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER
Definition: config.hpp:106
#define BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS
Definition: function.hpp:72
#define BOOST_CLBL_TRTS_IS_NOEXCEPT
Definition: function_2.hpp:12
#define BOOST_CLBL_TRTS_NOEXCEPT_SPEC
Definition: function_2.hpp:11
typename set_varargs_function_qualifiers_t< Flags, IsTransactionSafe, IsNoexcept, Ts... >::type set_varargs_function_qualifiers
typename set_function_qualifiers_t< Flags, IsTransactionSafe, IsNoexcept, Ts... >::type set_function_qualifiers
Return(Args...,...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE remove_noexcept
Definition: function_3.hpp:185
set_varargs_function_qualifiers< Flags, is_transaction_safe::value, is_noexcept::value, Return, Args... > set_qualifiers
Definition: function_3.hpp:207
Return(Args...,...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER BOOST_CLBL_TRTS_NOEXCEPT_SPEC add_transaction_safe
Definition: function_3.hpp:201
Return(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC U::*)(Args...,...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE BOOST_CLBL_TRTS_NOEXCEPT_SPEC apply_member_pointer
Definition: function_3.hpp:248
Return(Args...,...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_NOEXCEPT_SPEC remove_transaction_safe
Definition: function_3.hpp:196
set_qualifiers< qualifiers::ref_flags|remove_volatile_flag< qualifiers::cv_flags >::value > remove_member_volatile
Definition: function_3.hpp:239
Return(Args...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE BOOST_CLBL_TRTS_NOEXCEPT_SPEC remove_varargs
Definition: function_3.hpp:177
Return(Args...,...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER add_noexcept
Definition: function_3.hpp:190
set_qualifiers< qualifiers::ref_flags|remove_const_flag< qualifiers::cv_flags >::value > remove_member_const
Definition: function_3.hpp:236
Return(Args...,...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE BOOST_CLBL_TRTS_NOEXCEPT_SPEC qualified_function_type
Definition: function_3.hpp:172
Return(Args...,...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE BOOST_CLBL_TRTS_NOEXCEPT_SPEC type
Definition: function_3.hpp:165
NewReturn(Args...,...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE BOOST_CLBL_TRTS_NOEXCEPT_SPEC apply_return
Definition: function_3.hpp:254
Return(Args...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER add_noexcept
Definition: function_3.hpp:79
Return(Args...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE BOOST_CLBL_TRTS_NOEXCEPT_SPEC qualified_function_type
Definition: function_3.hpp:61
Return(Args...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE remove_noexcept
Definition: function_3.hpp:74
Return(Args...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER BOOST_CLBL_TRTS_NOEXCEPT_SPEC add_transaction_safe
Definition: function_3.hpp:90
NewReturn(Args...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE BOOST_CLBL_TRTS_NOEXCEPT_SPEC apply_return
Definition: function_3.hpp:139
set_qualifiers< qualifiers::ref_flags|remove_volatile_flag< qualifiers::cv_flags >::value > remove_member_volatile
Definition: function_3.hpp:128
set_qualifiers< qualifiers::ref_flags|remove_const_flag< qualifiers::cv_flags >::value > remove_member_const
Definition: function_3.hpp:125
Return(Args...,...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE BOOST_CLBL_TRTS_NOEXCEPT_SPEC add_varargs
Definition: function_3.hpp:68
set_function_qualifiers< Flags, is_transaction_safe::value, is_noexcept::value, Return, Args... > set_qualifiers
Definition: function_3.hpp:96
Return(Args...) BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE BOOST_CLBL_TRTS_NOEXCEPT_SPEC type
Definition: function_3.hpp:54
#define BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
Definition: function.hpp:11
#define BOOST_CLBL_TRTS_IS_TRANSACTION_SAFE
Definition: function.hpp:12