Added static tests for detect_or_t.

This commit is contained in:
Patrick Wuttke 2025-11-22 12:42:19 +01:00
parent 1172116d6b
commit 759174ed57

View File

@ -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