FTL: Add mixins for type-safe wrappers
For now, allow mixing in construction, default construction, equality,
ordering, incrementing, and addition.
Bug: 185536303
Test: ftl_test
Change-Id: I9017e124656ba0e7f13f378814c5b1c19a36655b
diff --git a/include/ftl/enum.h b/include/ftl/enum.h
index 82af1d6..075d12b 100644
--- a/include/ftl/enum.h
+++ b/include/ftl/enum.h
@@ -92,7 +92,7 @@
// enum class E { A, B, C };
// static_assert(ftl::to_underlying(E::B) == 1);
//
-template <typename E>
+template <typename E, typename = std::enable_if_t<std::is_enum_v<E>>>
constexpr auto to_underlying(E v) {
return static_cast<std::underlying_type_t<E>>(v);
}