cMHN 1.1
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_BASIC_COMMON_H
4#define pRC_CORE_BASIC_COMMON_H
5
7
8namespace pRC
9{
10 template<class TA, class TB>
12 {
13 template<class S>
14 struct Success
15 {
16 using Type = S;
17 };
18
19 struct Failure
20 {
21 };
22
23 template<class U1, class U2>
25 : declval<U2>())>>
27
28 template<class, class>
29 static Failure test(...);
30
31 using Type = decltype(test<TA, TB>(0));
32 };
33
34 template<class TA, class TB, class = If<>>
35 struct CommonType : DetectCommonType<TA, TB>::Type
36 {
37 };
38
39 template<class T, class... Ts>
40 struct CommonTypes : CommonTypes<typename CommonTypes<T, Ts>::Type...>
41 {
42 };
43
44 template<class TA, class TB>
45 struct CommonTypes<TA, TB> : CommonType<TA, TB>
46 {
47 };
48
49 template<class T>
50 struct CommonTypes<T> : CommonTypes<T, T>
51 {
52 };
53
54 template<class... Ts>
55 using Common = typename CommonTypes<Ts...>::Type;
56
57 template<class... Ts>
59}
60#endif // pRC_CORE_BASIC_COMMON_H
TN::Subscripts S
Definition externs_nonTT.hpp:9
pRC::Float<> T
Definition externs_nonTT.hpp:1
Definition cholesky.hpp:18
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
typename CommonTypes< Ts... >::Type Common
Definition common.hpp:55
Definition common.hpp:36
Definition common.hpp:41
Definition common.hpp:20
Definition common.hpp:15
S Type
Definition common.hpp:16
Definition common.hpp:12
static Failure test(...)
decltype(test< TA, TB >(0)) Type
Definition common.hpp:31
static Success< RemoveConstReference< decltype(false ? declval< U1 >() :declval< U2 >())> test(int)
Definition type_traits.hpp:159