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_SET_FUNCTION_QUALIFIERS_HPP
10 #define BOOST_CLBL_TRTS_DETAIL_SET_FUNCTION_QUALIFIERS_HPP
12 #include <boost/callable_traits/detail/qualifier_flags.hpp>
14 #define BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(QUAL) \
15 template<typename Return, typename... Args> \
16 struct set_function_qualifiers_t < \
17 flag_map<int QUAL>::value, false, false, Return, Args...> { \
18 using type = Return(Args...) QUAL; \
21 template<typename Return, typename... Args> \
22 struct set_function_qualifiers_t < \
23 flag_map<int QUAL>::value, true, false, Return, Args...> { \
24 using type = Return(Args...) QUAL \
25 BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER; \
28 template<typename Return, typename... Args> \
29 struct set_function_qualifiers_t < \
30 flag_map<int QUAL>::value, false, true, Return, Args...> { \
31 using type = Return(Args...) QUAL \
32 BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER; \
35 template<typename Return, typename... Args> \
36 struct set_function_qualifiers_t < \
37 flag_map<int QUAL>::value, true, true, Return, Args...> { \
38 using type = Return(Args...) QUAL \
39 BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER \
40 BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER; \
43 template<typename Return, typename... Args> \
44 struct set_varargs_function_qualifiers_t < \
45 flag_map<int QUAL>::value, false, false, Return, Args...> { \
46 using type = Return(Args..., ...) QUAL; \
49 template<typename Return, typename... Args> \
50 struct set_varargs_function_qualifiers_t < \
51 flag_map<int QUAL>::value, true, false, Return, Args...> { \
52 using type = Return(Args..., ...) QUAL \
53 BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER; \
56 template<typename Return, typename... Args> \
57 struct set_varargs_function_qualifiers_t < \
58 flag_map<int QUAL>::value, false, true, Return, Args...> { \
59 using type = Return(Args..., ...) QUAL \
60 BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER; \
63 template<typename Return, typename... Args> \
64 struct set_varargs_function_qualifiers_t < \
65 flag_map<int QUAL>::value, true, true, Return, Args...> { \
66 using type = Return(Args..., ...) QUAL \
67 BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER \
68 BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER; \
72 namespace boost { namespace callable_traits { namespace detail {
74 template<qualifier_flags Applied, bool IsTransactionSafe,
75 bool IsNoexcept, typename Return, typename... Args>
76 struct set_function_qualifiers_t {
77 using type = Return(Args...);
80 template<qualifier_flags Applied, bool IsTransactionSafe,
81 bool IsNoexcept, typename Return, typename... Args>
82 struct set_varargs_function_qualifiers_t {
83 using type = Return(Args..., ...);
86 #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
88 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(const);
89 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(volatile);
90 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(const volatile);
92 #ifndef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
94 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(&);
95 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(&&);
96 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(const &);
97 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(const &&);
98 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(volatile &);
99 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(volatile &&);
100 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(const volatile &);
101 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(const volatile &&);
103 #endif // #ifndef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
104 #endif // #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
106 template<qualifier_flags Flags, bool IsTransactionSafe, bool IsNoexcept,
108 using set_function_qualifiers =
109 typename set_function_qualifiers_t<Flags, IsTransactionSafe, IsNoexcept,
112 template<qualifier_flags Flags, bool IsTransactionSafe, bool IsNoexcept,
114 using set_varargs_function_qualifiers =
115 typename set_varargs_function_qualifiers_t<Flags, IsTransactionSafe,
116 IsNoexcept, Ts...>::type;
118 }}} // namespace boost::callable_traits::detail
120 #endif //BOOST_CLBL_TRTS_DETAIL_SET_FUNCTION_QUALIFIERS_HPP