cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
common.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_VALUE_COMMON_H
4#define pRC_CORE_VALUE_COMMON_H
5
8
9namespace std
10{
11 template<pRC::IsSignedInteger TA, pRC::IsSignedInteger TB>
12 struct common_type<TA, TB>
13 {
14 using type = pRC::Conditional<(sizeof(TA) > sizeof(TB)), TA, TB>;
15 };
16
17 template<pRC::IsUnsignedInteger TA, pRC::IsUnsignedInteger TB>
18 struct common_type<TA, TB>
19 {
20 using type = pRC::Conditional<(sizeof(TA) > sizeof(TB)), TA, TB>;
21 };
22
23 template<pRC::IsSignedInteger TA, pRC::IsUnsignedInteger TB>
24 struct common_type<TA, TB>
25 {
26 using type = pRC::Conditional<(sizeof(TA) > sizeof(TB)), TA, TB>;
27 };
28
29 template<pRC::IsUnsignedInteger TA, pRC::IsSignedInteger TB>
30 struct common_type<TA, TB>
31 {
32 using type = pRC::Conditional<(sizeof(TA) >= sizeof(TB)), TA, TB>;
33 };
34
35 template<pRC::IsFloat TA, pRC::IsFloat TB>
36 struct common_type<TA, TB>
37 {
38 using type = pRC::Conditional<(sizeof(TA) > sizeof(TB)), TA, TB>;
39 };
40
41 template<pRC::IsFloat TA, pRC::IsInteger TB>
42 struct common_type<TA, TB> : common_type<TA, pRC::Float<>>
43 {
44 };
45
46 template<pRC::IsInteger TA, pRC::IsFloat TB>
47 struct common_type<TA, TB> : common_type<pRC::Float<>, TB>
48 {
49 };
50}
51#endif // pRC_CORE_VALUE_COMMON_H
std::conditional_t< B, T, F > Conditional
Definition basics.hpp:56
Definition common.hpp:10
pRC::Conditional<(sizeof(TA) > sizeof(TB)), TA, TB > type
Definition common.hpp:14