template <typename T>
struct is_same<T, T> : public true_type {};
+// conditional<B, T, F>
+//
+// Defines type as T if B is true or as F otherwise.
+// E.g. the following is true
+//
+// ```
+// is_same<int, conditional<true, int, double>::type>::value
+// is_same<double, conditional<false, int, double>::type>::value
+// ```
+template <bool B, class T, class F>
+struct conditional {
+ using type = T;
+};
+
+template <class T, class F>
+struct conditional<false, T, F> {
+ using type = F;
+};
+
} // namespace __sanitizer
#endif
ASSERT_FALSE((is_same<uptr, sptr>::value));
ASSERT_FALSE((is_same<uptr, const uptr>::value));
}
+
+TEST(SanitizerCommon, Conditional) {
+ ASSERT_TRUE((is_same<int, conditional<true, int, double>::type>::value));
+ ASSERT_TRUE((is_same<double, conditional<false, int, double>::type>::value));
+}