From 67c682d5a2aca0d70e3dd2ee5aff9eb47c82c185 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 29 Aug 2019 14:05:18 +1000 Subject: [PATCH] strongdef: pretend to be an enum for introspection purposes --- strongdef.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/strongdef.hpp b/strongdef.hpp index 78bdd231..9de4beaa 100644 --- a/strongdef.hpp +++ b/strongdef.hpp @@ -25,6 +25,10 @@ namespace cruft::strongdef { using value_type = T; using tag_type = TagT; + /// We detect underlying_type in a few situations where we emulate + /// 'enum-like' structures. This lets us opt in to this behaviour. + using underlying_type = T; + // TODO: ideally we'd default the constructor, but templated // constructors can't be defaulted? So we just stub one out. constexpr explicit index () { ; } @@ -144,9 +148,8 @@ namespace cruft::types { template struct category_traits< ::cruft::strongdef::index - > : - public category_traits - {}; + > : public std::integral_constant + { ; }; template