strongdef: pretend to be an enum for introspection purposes

This commit is contained in:
Danny Robson 2019-08-29 14:05:18 +10:00
parent 458654c9a3
commit 67c682d5a2

View File

@ -25,6 +25,10 @@ namespace cruft::strongdef {
using value_type = T; using value_type = T;
using tag_type = TagT; 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 // TODO: ideally we'd default the constructor, but templated
// constructors can't be defaulted? So we just stub one out. // constructors can't be defaulted? So we just stub one out.
constexpr explicit index () { ; } constexpr explicit index () { ; }
@ -144,9 +148,8 @@ namespace cruft::types {
template <typename TagT, typename ValueT> template <typename TagT, typename ValueT>
struct category_traits< struct category_traits<
::cruft::strongdef::index<TagT,ValueT> ::cruft::strongdef::index<TagT,ValueT>
> : > : public std::integral_constant<category,category::ENUM>
public category_traits<ValueT> { ; };
{};
template <typename TagT, typename ValueT> template <typename TagT, typename ValueT>