Skip to content

Commit 1dc6579

Browse files
committed
fix: MSVC build
1 parent 7942fe7 commit 1dc6579

File tree

1 file changed

+155
-42
lines changed

1 file changed

+155
-42
lines changed

src/details.h

Lines changed: 155 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -51,149 +51,262 @@ struct function_traits;
5151
* @brief Specialization for function pointers.
5252
*
5353
* @tparam R The return type of the function.
54-
* @tparam NX Whether the function is noexcept.
5554
* @tparam Args The argument types of the function.
5655
*/
57-
template<typename R, bool NX, typename... Args>
58-
struct function_traits<R (*)(Args...) noexcept(NX)> {
56+
template<typename R, typename... Args>
57+
struct function_traits<R (*)(Args...)> {
5958
using return_type = R; ///< The return type of the function.
6059
using args_tuple = std::tuple<Args...>; ///< A tuple of the argument types.
6160
};
6261

62+
/**
63+
* @brief Specialization for noexcept function pointers.
64+
*
65+
* @tparam R The return type of the function.
66+
* @tparam Args The argument types of the function.
67+
*/
68+
template<typename R, typename... Args>
69+
struct function_traits<R (*)(Args...) noexcept> : function_traits<R (*)(Args...)> {};
70+
6371
/**
6472
* @brief Specialization for member function pointers.
6573
*
6674
* @tparam R The return type of the member function.
6775
* @tparam C The class type.
68-
* @tparam NX Whether the member function is noexcept.
6976
* @tparam Args The argument types of the member function.
7077
*/
71-
template<typename R, typename C, bool NX, typename... Args>
72-
struct function_traits<R (C::*)(Args...) noexcept(NX)> : function_traits<R (*)(Args...) noexcept(NX)> {};
78+
template<typename R, typename C, typename... Args>
79+
struct function_traits<R (C::*)(Args...)> : function_traits<R (*)(Args...)> {};
80+
81+
/**
82+
* @brief Specialization for noexcept member function pointers.
83+
*
84+
* @tparam R The return type of the member function.
85+
* @tparam C The class type.
86+
* @tparam Args The argument types of the member function.
87+
*/
88+
template<typename R, typename C, typename... Args>
89+
struct function_traits<R (C::*)(Args...) noexcept> : function_traits<R (C::*)(Args...)> {};
7390

7491
/**
7592
* @brief Specialization for const member function pointers.
7693
*
7794
* @tparam R The return type of the member function.
7895
* @tparam C The class type.
79-
* @tparam NX Whether the member function is noexcept.
8096
* @tparam Args The argument types of the member function.
8197
*/
82-
template<typename R, typename C, bool NX, typename... Args>
83-
struct function_traits<R (C::*)(Args...) const noexcept(NX)> : function_traits<R (C::*)(Args...) noexcept(NX)> {};
98+
template<typename R, typename C, typename... Args>
99+
struct function_traits<R (C::*)(Args...) const> : function_traits<R (C::*)(Args...)> {};
100+
101+
/**
102+
* @brief Specialization for const noexcept member function pointers.
103+
*
104+
* @tparam R The return type of the member function.
105+
* @tparam C The class type.
106+
* @tparam Args The argument types of the member function.
107+
*/
108+
template<typename R, typename C, typename... Args>
109+
struct function_traits<R (C::*)(Args...) const noexcept> : function_traits<R (C::*)(Args...)> {};
84110

85111
/**
86112
* @brief Specialization for volatile member function pointers.
87113
*
88114
* @tparam R The return type of the member function.
89115
* @tparam C The class type.
90-
* @tparam NX Whether the member function is noexcept.
91116
* @tparam Args The argument types of the member function.
92117
*/
93-
template<typename R, typename C, bool NX, typename... Args>
94-
struct function_traits<R (C::*)(Args...) volatile noexcept(NX)> : function_traits<R (C::*)(Args...) noexcept(NX)> {};
118+
template<typename R, typename C, typename... Args>
119+
struct function_traits<R (C::*)(Args...) volatile> : function_traits<R (C::*)(Args...)> {};
120+
121+
/**
122+
* @brief Specialization for volatile noexcept member function pointers.
123+
*
124+
* @tparam R The return type of the member function.
125+
* @tparam C The class type.
126+
* @tparam Args The argument types of the member function.
127+
*/
128+
template<typename R, typename C, typename... Args>
129+
struct function_traits<R (C::*)(Args...) volatile noexcept> : function_traits<R (C::*)(Args...)> {};
95130

96131
/**
97132
* @brief Specialization for const volatile member function pointers.
98133
*
99134
* @tparam R The return type of the member function.
100135
* @tparam C The class type.
101-
* @tparam NX Whether the member function is noexcept.
102136
* @tparam Args The argument types of the member function.
103137
*/
104-
template<typename R, typename C, bool NX, typename... Args>
105-
struct function_traits<R (C::*)(Args...) const volatile noexcept(NX)>
106-
: function_traits<R (C::*)(Args...) noexcept(NX)> {};
138+
template<typename R, typename C, typename... Args>
139+
struct function_traits<R (C::*)(Args...) const volatile> : function_traits<R (C::*)(Args...)> {};
140+
141+
/**
142+
* @brief Specialization for const volatile noexcept member function pointers.
143+
*
144+
* @tparam R The return type of the member function.
145+
* @tparam C The class type.
146+
* @tparam Args The argument types of the member function.
147+
*/
148+
template<typename R, typename C, typename... Args>
149+
struct function_traits<R (C::*)(Args...) const volatile noexcept> : function_traits<R (C::*)(Args...)> {};
107150

108151
/**
109152
* @brief Specialization for lvalue reference member function pointers.
110153
*
111154
* @tparam R The return type of the member function.
112155
* @tparam C The class type.
113-
* @tparam NX Whether the member function is noexcept.
114156
* @tparam Args The argument types of the member function.
115157
*/
116-
template<typename R, typename C, bool NX, typename... Args>
117-
struct function_traits<R (C::*)(Args...) & noexcept(NX)> : function_traits<R (C::*)(Args...) noexcept(NX)> {};
158+
template<typename R, typename C, typename... Args>
159+
struct function_traits<R (C::*)(Args...) &> : function_traits<R (C::*)(Args...)> {};
160+
161+
/**
162+
* @brief Specialization for lvalue reference noexcept member function pointers.
163+
*
164+
* @tparam R The return type of the member function.
165+
* @tparam C The class type.
166+
* @tparam Args The argument types of the member function.
167+
*/
168+
template<typename R, typename C, typename... Args>
169+
struct function_traits<R (C::*)(Args...) & noexcept> : function_traits<R (C::*)(Args...)> {};
118170

119171
/**
120172
* @brief Specialization for const lvalue reference member function pointers.
121173
*
122174
* @tparam R The return type of the member function.
123175
* @tparam C The class type.
124-
* @tparam NX Whether the member function is noexcept.
125176
* @tparam Args The argument types of the member function.
126177
*/
127-
template<typename R, typename C, bool NX, typename... Args>
128-
struct function_traits<R (C::*)(Args...) const & noexcept(NX)> : function_traits<R (C::*)(Args...) noexcept(NX)> {};
178+
template<typename R, typename C, typename... Args>
179+
struct function_traits<R (C::*)(Args...) const&> : function_traits<R (C::*)(Args...)> {};
180+
181+
/**
182+
* @brief Specialization for const lvalue reference noexcept member function pointers.
183+
*
184+
* @tparam R The return type of the member function.
185+
* @tparam C The class type.
186+
* @tparam Args The argument types of the member function.
187+
*/
188+
template<typename R, typename C, typename... Args>
189+
struct function_traits<R (C::*)(Args...) const & noexcept> : function_traits<R (C::*)(Args...)> {};
129190

130191
/**
131192
* @brief Specialization for volatile lvalue reference member function pointers.
132193
*
133194
* @tparam R The return type of the member function.
134195
* @tparam C The class type.
135-
* @tparam NX Whether the member function is noexcept.
136196
* @tparam Args The argument types of the member function.
137197
*/
138-
template<typename R, typename C, bool NX, typename... Args>
139-
struct function_traits<R (C::*)(Args...) volatile & noexcept(NX)> : function_traits<R (C::*)(Args...) noexcept(NX)> {};
198+
template<typename R, typename C, typename... Args>
199+
struct function_traits<R (C::*)(Args...) volatile&> : function_traits<R (C::*)(Args...)> {};
200+
201+
/**
202+
* @brief Specialization for volatile lvalue reference noexcept member function pointers.
203+
*
204+
* @tparam R The return type of the member function.
205+
* @tparam C The class type.
206+
* @tparam Args The argument types of the member function.
207+
*/
208+
template<typename R, typename C, typename... Args>
209+
struct function_traits<R (C::*)(Args...) volatile & noexcept> : function_traits<R (C::*)(Args...)> {};
140210

141211
/**
142212
* @brief Specialization for const volatile lvalue reference member function pointers.
143213
*
144214
* @tparam R The return type of the member function.
145215
* @tparam C The class type.
146-
* @tparam NX Whether the member function is noexcept.
147216
* @tparam Args The argument types of the member function.
148217
*/
149-
template<typename R, typename C, bool NX, typename... Args>
150-
struct function_traits<R (C::*)(Args...) const volatile & noexcept(NX)>
151-
: function_traits<R (C::*)(Args...) noexcept(NX)> {};
218+
template<typename R, typename C, typename... Args>
219+
struct function_traits<R (C::*)(Args...) const volatile&> : function_traits<R (C::*)(Args...)> {};
220+
221+
/**
222+
* @brief Specialization for const volatile lvalue reference noexcept member function pointers.
223+
*
224+
* @tparam R The return type of the member function.
225+
* @tparam C The class type.
226+
* @tparam Args The argument types of the member function.
227+
*/
228+
template<typename R, typename C, typename... Args>
229+
struct function_traits<R (C::*)(Args...) const volatile & noexcept> : function_traits<R (C::*)(Args...)> {};
152230

153231
/**
154232
* @brief Specialization for rvalue reference member function pointers.
155233
*
156234
* @tparam R The return type of the member function.
157235
* @tparam C The class type.
158-
* @tparam NX Whether the member function is noexcept.
159236
* @tparam Args The argument types of the member function.
160237
*/
161-
template<typename R, typename C, bool NX, typename... Args>
162-
struct function_traits<R (C::*)(Args...) && noexcept(NX)> : function_traits<R (C::*)(Args...) noexcept(NX)> {};
238+
template<typename R, typename C, typename... Args>
239+
struct function_traits<R (C::*)(Args...) &&> : function_traits<R (C::*)(Args...)> {};
240+
241+
/**
242+
* @brief Specialization for rvalue reference noexcept member function pointers.
243+
*
244+
* @tparam R The return type of the member function.
245+
* @tparam C The class type.
246+
* @tparam Args The argument types of the member function.
247+
*/
248+
template<typename R, typename C, typename... Args>
249+
struct function_traits<R (C::*)(Args...) && noexcept> : function_traits<R (C::*)(Args...)> {};
163250

164251
/**
165252
* @brief Specialization for const rvalue reference member function pointers.
166253
*
167254
* @tparam R The return type of the member function.
168255
* @tparam C The class type.
169-
* @tparam NX Whether the member function is noexcept.
170256
* @tparam Args The argument types of the member function.
171257
*/
172-
template<typename R, typename C, bool NX, typename... Args>
173-
struct function_traits<R (C::*)(Args...) const && noexcept(NX)> : function_traits<R (C::*)(Args...) noexcept(NX)> {};
258+
template<typename R, typename C, typename... Args>
259+
struct function_traits<R (C::*)(Args...) const&&> : function_traits<R (C::*)(Args...)> {};
260+
261+
/**
262+
* @brief Specialization for const rvalue reference noexcept member function pointers.
263+
*
264+
* @tparam R The return type of the member function.
265+
* @tparam C The class type.
266+
* @tparam Args The argument types of the member function.
267+
*/
268+
template<typename R, typename C, typename... Args>
269+
struct function_traits<R (C::*)(Args...) const && noexcept> : function_traits<R (C::*)(Args...)> {};
174270

175271
/**
176272
* @brief Specialization for volatile rvalue reference member function pointers.
177273
*
178274
* @tparam R The return type of the member function.
179275
* @tparam C The class type.
180-
* @tparam NX Whether the member function is noexcept.
181276
* @tparam Args The argument types of the member function.
182277
*/
183-
template<typename R, typename C, bool NX, typename... Args>
184-
struct function_traits<R (C::*)(Args...) volatile && noexcept(NX)> : function_traits<R (C::*)(Args...) noexcept(NX)> {};
278+
template<typename R, typename C, typename... Args>
279+
struct function_traits<R (C::*)(Args...) volatile&&> : function_traits<R (C::*)(Args...)> {};
280+
281+
/**
282+
* @brief Specialization for volatile rvalue reference noexcept member function pointers.
283+
*
284+
* @tparam R The return type of the member function.
285+
* @tparam C The class type.
286+
* @tparam Args The argument types of the member function.
287+
*/
288+
template<typename R, typename C, typename... Args>
289+
struct function_traits<R (C::*)(Args...) volatile && noexcept> : function_traits<R (C::*)(Args...)> {};
185290

186291
/**
187292
* @brief Specialization for const volatile rvalue reference member function pointers.
188293
*
189294
* @tparam R The return type of the member function.
190295
* @tparam C The class type.
191-
* @tparam NX Whether the member function is noexcept.
192296
* @tparam Args The argument types of the member function.
193297
*/
194-
template<typename R, typename C, bool NX, typename... Args>
195-
struct function_traits<R (C::*)(Args...) const volatile && noexcept(NX)>
196-
: function_traits<R (C::*)(Args...) noexcept(NX)> {};
298+
template<typename R, typename C, typename... Args>
299+
struct function_traits<R (C::*)(Args...) const volatile&&> : function_traits<R (C::*)(Args...)> {};
300+
301+
/**
302+
* @brief Specialization for const volatile rvalue reference noexcept member function pointers.
303+
*
304+
* @tparam R The return type of the member function.
305+
* @tparam C The class type.
306+
* @tparam Args The argument types of the member function.
307+
*/
308+
template<typename R, typename C, typename... Args>
309+
struct function_traits<R (C::*)(Args...) const volatile && noexcept> : function_traits<R (C::*)(Args...)> {};
197310

198311
/**
199312
* @brief Specialization for `std::function`.

0 commit comments

Comments
 (0)