CommonLibSSE NG
Loading...
Searching...
No Matches
CommonTypeTraits.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/A/ActiveEffect.h"
4#include "RE/B/BGSBaseAlias.h"
6#include "RE/T/TESForm.h"
7
8namespace RE
9{
10 namespace BSScript
11 {
12 template <class T>
13 struct is_not_const :
14 std::negation<
15 std::is_const<T>>
16 {};
17
18 template <class T>
19 inline constexpr bool is_not_const_v = is_not_const<T>::value;
20
21 template <class T>
23 std::negation<
24 std::is_volatile<T>>
25 {};
26
27 template <class T>
29
30 template <class T>
32 std::negation<
33 std::is_reference<T>>
34 {};
35
36 template <class T>
38
39 template <class T>
41 std::negation<
42 std::is_pointer<T>>
43 {};
44
45 template <class T>
47
48 template <class, class = void>
50 std::false_type
51 {};
52
53 template <class T>
55 T,
56 std::void_t<
57 typename T::value_type>> :
58 std::true_type
59 {};
60
61 template <class T>
63
64 template <class, class = void>
66 std::false_type
67 {};
68
69 template <class T>
71 T,
72 std::void_t<
73 typename T::size_type>> :
74 std::true_type
75 {};
76
77 template <class T>
79
80 template <class, class = void>
82 std::false_type
83 {};
84
85 template <class T>
87 T,
88 std::void_t<
89 typename T::iterator>> :
90 std::true_type
91 {};
92
93 template <class T>
95
96 template <class, class = void>
98 std::false_type
99 {};
100
101 template <class T>
103 T,
104 std::enable_if_t<
105 std::is_same_v<
106 typename T::iterator,
107 decltype(std::declval<T>().begin())>>> :
108 std::true_type
109 {};
110
111 template <class T>
113
114 template <class, class = void>
116 std::false_type
117 {};
118
119 template <class T>
121 T,
122 std::enable_if_t<
123 std::is_same_v<
124 typename T::iterator,
125 decltype(std::declval<T>().end())>>> :
126 std::true_type
127 {};
128
129 template <class T>
131
132 template <class, class = void>
134 std::false_type
135 {};
136
137 template <class T>
139 T,
140 std::enable_if_t<
141 std::is_invocable_r_v<
142 typename T::size_type,
143 decltype(&T::size),
144 T>>> :
145 std::true_type
146 {};
147
148 template <class T>
150
151 template <class, class = void>
153 std::false_type
154 {};
155
156 template <class T>
158 T,
159 std::void_t<
160 decltype(std::declval<T>().push_back(std::declval<typename T::value_type>()))>> :
161 std::true_type
162 {};
163
164 template <class T>
166
167 template <class T>
168 struct _is_integer :
169 std::is_integral<T>
170 {};
171
172 template <>
173 struct _is_integer<bool> :
174 std::false_type
175 {};
176
177 template <class T>
178 struct is_integer :
180 std::remove_cv_t<T>>
181 {};
182
183 template <class T>
184 inline constexpr bool is_integer_v = is_integer<T>::value;
185
186 template <class T>
188 std::make_index_sequence<
189 std::tuple_size_v<
190 std::decay_t<T>>>
191 {};
192
193 template <class T>
195 std::decay_t<
196 std::remove_pointer<T>>
197 {};
198
199 template <class T>
201
202 template <class T>
203 struct is_string :
204 std::is_same<
205 std::remove_cv_t<T>,
206 BSFixedString>
207 {};
208
209 template <class T>
210 inline constexpr bool is_string_v = is_string<T>::value;
211
212 template <class T>
214 std::conjunction<
215 is_integer<T>,
216 std::is_signed<T>,
217 std::bool_constant<sizeof(T) == 4>>
218 {};
219
220 template <class T>
222
223 template <class T>
225 std::conjunction<
226 is_integer<T>,
227 std::is_unsigned<T>,
228 std::bool_constant<sizeof(T) == 4>>
229 {};
230
231 template <class T>
233
234 template <class T>
235 struct is_integral :
236 std::disjunction<
237 is_signed_integral<T>,
238 is_unsigned_integral<T>>
239 {};
240
241 template <class T>
242 inline constexpr bool is_integral_v = is_integral<T>::value;
243
244 template <class T>
246 std::is_same<
247 std::remove_cv_t<T>,
248 float>
249 {};
250
251 template <class T>
253
254 template <class T>
255 struct is_boolean :
256 std::is_same<
257 std::remove_cv_t<T>,
258 bool>
259 {};
260
261 template <class T>
262 inline constexpr bool is_boolean_v = is_boolean<T>::value;
263
264 template <class T>
265 struct is_builtin :
266 std::disjunction<
267 std::is_void<T>,
268 is_string<T>,
269 is_signed_integral<T>,
270 is_unsigned_integral<T>,
271 is_floating_point<T>,
272 is_boolean<T>>
273 {};
274
275 template <class T>
276 inline constexpr bool is_builtin_v = is_builtin<T>::value;
277
278 template <class T>
280 std::is_convertible<T, std::string_view>
281 {};
282
283 template <class T>
285
286 template <class T, class = void>
288 std::conjunction<
289 is_integer<T>,
290 std::is_signed<T>>
291 {};
292
293 template <class T>
295 T,
296 std::enable_if_t<
297 std::is_enum_v<T>>> :
298 std::is_signed<
299 std::underlying_type_t<T>>
300 {};
301
302 template <class T>
304
305 template <class T, class = void>
307 std::conjunction<
308 is_integer<T>,
309 std::is_unsigned<T>>
310 {};
311
312 template <class T>
314 T,
315 std::enable_if_t<
316 std::is_enum_v<T>>> :
317 std::is_unsigned<
318 std::underlying_type_t<T>>
319 {};
320
321 template <class T>
323
324 template <class T>
326 std::disjunction<
327 is_signed_integral_convertible<T>,
328 is_unsigned_integral_convertible<T>>
329 {};
330
331 template <class T>
333
334 template <class T>
336 std::is_floating_point<T>
337 {};
338
339 template <class T>
341
342 template <class T>
344 std::disjunction<
345 std::is_void<T>,
346 is_string_convertible<T>,
347 is_signed_integral_convertible<T>,
348 is_unsigned_integral_convertible<T>,
349 is_floating_point_convertible<T>,
350 is_boolean<T>>
351 {};
352
353 template <class T>
355
356 template <class T>
357 struct is_form :
358 std::is_base_of<
359 RE::TESForm,
360 std::remove_cv_t<T>>
361 {};
362
363 template <class T>
364 inline constexpr bool is_form_v = is_form<T>::value;
365
366 template <class T>
368 std::conjunction<
369 is_form<
370 std::remove_pointer_t<T>>,
371 std::is_pointer<T>>
372 {};
373
374 template <class T>
376
377 template <class T>
378 struct is_alias :
379 std::is_base_of<
380 RE::BGSBaseAlias,
381 std::remove_cv_t<T>>
382 {};
383
384 template <class T>
385 inline constexpr bool is_alias_v = is_alias<T>::value;
386
387 template <class T>
389 std::conjunction<
390 is_alias<
391 std::remove_pointer_t<T>>,
392 std::is_pointer<T>>
393 {};
394
395 template <class T>
397
398 template <class T>
400 std::is_base_of<
401 RE::ActiveEffect,
402 std::remove_cv_t<T>>
403 {};
404
405 template <class T>
407
408 template <class T>
410 std::conjunction<
411 is_active_effect<
412 std::remove_pointer_t<T>>,
413 std::is_pointer<T>>
414 {};
415
416 template <class T>
418
419 template <class T>
420 struct _is_array :
421 std::conjunction<
422 std::negation<
423 is_string_convertible<T>>,
424 std::is_default_constructible<T>,
425 std::is_destructible<T>,
426 is_not_reference<T>,
427 is_not_pointer<T>,
428 defines_value_type<T>,
429 defines_size_type<T>,
430 defines_iterator<T>,
431 implements_begin<T>,
432 implements_end<T>,
433 implements_size<T>,
434 implements_push_back<T>>
435 {};
436
437 template <>
438 struct _is_array<
439 std::vector<bool>> :
440 std::true_type
441 {};
442
443 template <class T>
444 struct is_array :
445 _is_array<
446 std::remove_cv_t<T>>
447 {};
448
449 template <class T>
450 inline constexpr bool is_array_v = is_array<T>::value;
451 }
452}
constexpr bool defines_value_type_v
Definition CommonTypeTraits.h:62
constexpr bool implements_begin_v
Definition CommonTypeTraits.h:112
constexpr bool is_unsigned_integral_v
Definition CommonTypeTraits.h:232
constexpr bool is_alias_pointer_v
Definition CommonTypeTraits.h:396
typename decay_pointer< T >::type decay_pointer_t
Definition CommonTypeTraits.h:200
constexpr bool is_alias_v
Definition CommonTypeTraits.h:385
constexpr bool is_unsigned_integral_convertible_v
Definition CommonTypeTraits.h:322
constexpr bool is_form_pointer_v
Definition CommonTypeTraits.h:375
constexpr bool is_floating_point_convertible_v
Definition CommonTypeTraits.h:340
constexpr bool is_signed_integral_v
Definition CommonTypeTraits.h:221
constexpr bool is_boolean_v
Definition CommonTypeTraits.h:262
constexpr bool is_string_v
Definition CommonTypeTraits.h:210
constexpr bool implements_end_v
Definition CommonTypeTraits.h:130
constexpr bool defines_size_type_v
Definition CommonTypeTraits.h:78
constexpr bool is_string_convertible_v
Definition CommonTypeTraits.h:284
constexpr bool is_form_v
Definition CommonTypeTraits.h:364
constexpr bool is_floating_point_v
Definition CommonTypeTraits.h:252
constexpr bool implements_size_v
Definition CommonTypeTraits.h:149
constexpr bool implements_push_back_v
Definition CommonTypeTraits.h:165
constexpr bool is_not_reference_v
Definition CommonTypeTraits.h:37
constexpr bool is_active_effect_pointer_v
Definition CommonTypeTraits.h:417
constexpr bool is_not_pointer_v
Definition CommonTypeTraits.h:46
constexpr bool is_array_v
Definition CommonTypeTraits.h:450
constexpr bool defines_iterator_v
Definition CommonTypeTraits.h:94
constexpr bool is_signed_integral_convertible_v
Definition CommonTypeTraits.h:303
constexpr bool is_not_const_v
Definition CommonTypeTraits.h:19
constexpr bool is_builtin_convertible_v
Definition CommonTypeTraits.h:354
constexpr bool is_integral_convertible_v
Definition CommonTypeTraits.h:332
constexpr bool is_integral_v
Definition CommonTypeTraits.h:242
constexpr bool is_not_volatile_v
Definition CommonTypeTraits.h:28
constexpr bool is_integer_v
Definition CommonTypeTraits.h:184
constexpr bool is_active_effect_v
Definition CommonTypeTraits.h:406
constexpr bool is_builtin_v
Definition CommonTypeTraits.h:276
Definition AbsorbEffect.h:6
Definition ActorValueList.h:28
Definition CommonTypeTraits.h:435
Definition CommonTypeTraits.h:170
Definition CommonTypeTraits.h:197
Definition CommonTypeTraits.h:83
Definition CommonTypeTraits.h:67
Definition CommonTypeTraits.h:51
Definition CommonTypeTraits.h:99
Definition CommonTypeTraits.h:117
Definition CommonTypeTraits.h:154
Definition CommonTypeTraits.h:135
Definition CommonTypeTraits.h:191
Definition CommonTypeTraits.h:414
Definition CommonTypeTraits.h:403
Definition CommonTypeTraits.h:393
Definition CommonTypeTraits.h:382
Definition CommonTypeTraits.h:447
Definition CommonTypeTraits.h:259
Definition CommonTypeTraits.h:351
Definition CommonTypeTraits.h:273
Definition CommonTypeTraits.h:337
Definition CommonTypeTraits.h:249
Definition CommonTypeTraits.h:372
Definition CommonTypeTraits.h:361
Definition CommonTypeTraits.h:181
Definition CommonTypeTraits.h:329
Definition CommonTypeTraits.h:239
Definition CommonTypeTraits.h:16
Definition CommonTypeTraits.h:43
Definition CommonTypeTraits.h:34
Definition CommonTypeTraits.h:25
Definition CommonTypeTraits.h:291
Definition CommonTypeTraits.h:218
Definition CommonTypeTraits.h:281
Definition CommonTypeTraits.h:207
Definition CommonTypeTraits.h:310
Definition CommonTypeTraits.h:229