diff --git a/include/cpp2util.h b/include/cpp2util.h index ca7e7999e..e791ed97f 100644 --- a/include/cpp2util.h +++ b/include/cpp2util.h @@ -548,6 +548,14 @@ auto is( X const& x ) -> bool { return x == X(); } +template< auto value, typename X > +auto is( X const& x ) -> bool { + if constexpr (std::is_convertible_v) { + return x == value; + } else { + return false; + } +} //------------------------------------------------------------------------------------------------------------- // Built-in as (partial)