Added static tests for detect_or_t.
This commit is contained in:
parent
1172116d6b
commit
759174ed57
@ -300,6 +300,19 @@ static_assert(union_type<MyTemplate<int, int>, MyTemplate<double, double>, MyTem
|
||||
static_assert(!union_type<int*, int>);
|
||||
static_assert(union_type<int*, std::is_pointer<Type_>>);
|
||||
static_assert(!union_type<int, std::is_pointer<Type_>>);
|
||||
|
||||
struct DetectNo {};
|
||||
struct DetectYes {
|
||||
using some_type = double;
|
||||
};
|
||||
template<typename T>
|
||||
using detect_some_type = typename T::some_type;
|
||||
|
||||
template<typename T>
|
||||
using some_type = detect_or_t<int, detect_some_type, T>;
|
||||
|
||||
static_assert(std::is_same_v<some_type<DetectNo>, int>);
|
||||
static_assert(std::is_same_v<some_type<DetectYes>, double>);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user