File indexing completed on 2025-01-18 09:29:45
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_CLBL_TRTS_DETAIL_SET_FUNCTION_QUALIFIERS_HPP
0010 #define BOOST_CLBL_TRTS_DETAIL_SET_FUNCTION_QUALIFIERS_HPP
0011
0012 #include <boost/callable_traits/detail/qualifier_flags.hpp>
0013
0014 #define BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(QUAL) \
0015 template<typename Return, typename... Args> \
0016 struct set_function_qualifiers_t < \
0017 flag_map<int QUAL>::value, false, false, Return, Args...> { \
0018 using type = Return(Args...) QUAL; \
0019 }; \
0020 \
0021 template<typename Return, typename... Args> \
0022 struct set_function_qualifiers_t < \
0023 flag_map<int QUAL>::value, true, false, Return, Args...> { \
0024 using type = Return(Args...) QUAL \
0025 BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER; \
0026 }; \
0027 \
0028 template<typename Return, typename... Args> \
0029 struct set_function_qualifiers_t < \
0030 flag_map<int QUAL>::value, false, true, Return, Args...> { \
0031 using type = Return(Args...) QUAL \
0032 BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER; \
0033 }; \
0034 \
0035 template<typename Return, typename... Args> \
0036 struct set_function_qualifiers_t < \
0037 flag_map<int QUAL>::value, true, true, Return, Args...> { \
0038 using type = Return(Args...) QUAL \
0039 BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER \
0040 BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER; \
0041 }; \
0042 \
0043 template<typename Return, typename... Args> \
0044 struct set_varargs_function_qualifiers_t < \
0045 flag_map<int QUAL>::value, false, false, Return, Args...> { \
0046 using type = Return(Args..., ...) QUAL; \
0047 }; \
0048 \
0049 template<typename Return, typename... Args> \
0050 struct set_varargs_function_qualifiers_t < \
0051 flag_map<int QUAL>::value, true, false, Return, Args...> { \
0052 using type = Return(Args..., ...) QUAL \
0053 BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER; \
0054 }; \
0055 \
0056 template<typename Return, typename... Args> \
0057 struct set_varargs_function_qualifiers_t < \
0058 flag_map<int QUAL>::value, false, true, Return, Args...> { \
0059 using type = Return(Args..., ...) QUAL \
0060 BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER; \
0061 }; \
0062 \
0063 template<typename Return, typename... Args> \
0064 struct set_varargs_function_qualifiers_t < \
0065 flag_map<int QUAL>::value, true, true, Return, Args...> { \
0066 using type = Return(Args..., ...) QUAL \
0067 BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER \
0068 BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER; \
0069 } \
0070
0071
0072 namespace boost { namespace callable_traits { namespace detail {
0073
0074 template<qualifier_flags Applied, bool IsTransactionSafe,
0075 bool IsNoexcept, typename Return, typename... Args>
0076 struct set_function_qualifiers_t {
0077 using type = Return(Args...);
0078 };
0079
0080 template<qualifier_flags Applied, bool IsTransactionSafe,
0081 bool IsNoexcept, typename Return, typename... Args>
0082 struct set_varargs_function_qualifiers_t {
0083 using type = Return(Args..., ...);
0084 };
0085
0086 #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
0087
0088 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(const);
0089 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(volatile);
0090 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(const volatile);
0091
0092 #ifndef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
0093
0094 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(&);
0095 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(&&);
0096 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(const &);
0097 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(const &&);
0098 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(volatile &);
0099 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(volatile &&);
0100 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(const volatile &);
0101 BOOST_CLBL_TRTS_SET_FUNCTION_QUALIFIERS(const volatile &&);
0102
0103 #endif
0104 #endif
0105
0106 template<qualifier_flags Flags, bool IsTransactionSafe, bool IsNoexcept,
0107 typename... Ts>
0108 using set_function_qualifiers =
0109 typename set_function_qualifiers_t<Flags, IsTransactionSafe, IsNoexcept,
0110 Ts...>::type;
0111
0112 template<qualifier_flags Flags, bool IsTransactionSafe, bool IsNoexcept,
0113 typename... Ts>
0114 using set_varargs_function_qualifiers =
0115 typename set_varargs_function_qualifiers_t<Flags, IsTransactionSafe,
0116 IsNoexcept, Ts...>::type;
0117
0118 }}}
0119
0120 #endif