diff --git a/parse/enum.hpp b/parse/enum.hpp index a9bedf7f..63378000 100644 --- a/parse/enum.hpp +++ b/parse/enum.hpp @@ -218,6 +218,26 @@ namespace cruft::parse::enumeration { } + /// Returns true if a typeidx has been registered for enumeration + /// reflection. + inline + bool is_registered (int idx) + { + auto const &dat = detail::cache (); + auto const pos = dat.find (idx); + return pos != dat.cend (); + } + + + /// Returns true if a typename has been registered for enumation + /// reflection. + template + bool is_registered (void) + { + return is_registered (cruft::typeidx ()); + } + + /// Lookup an enumeration value given a string representation. /// /// The string view is taken by reference and will be modified so that it