diff --git a/include/fc/static_variant.hpp b/include/fc/static_variant.hpp index 02fb5dc..88efeda 100644 --- a/include/fc/static_variant.hpp +++ b/include/fc/static_variant.hpp @@ -382,5 +382,46 @@ public: s.visit( to_static_variant(ar[1], max_depth - 1) ); } - template struct get_typename { static const char* name() { return typeid(static_variant).name(); } }; + template< typename... T > struct get_comma_separated_typenames; + + template<> + struct get_comma_separated_typenames<> + { + static const char* names() { return ""; } + }; + + template< typename T > + struct get_comma_separated_typenames + { + static const char* names() + { + static const std::string n = get_typename::name(); + return n.c_str(); + } + }; + + template< typename T, typename... Ts > + struct get_comma_separated_typenames + { + static const char* names() + { + static const std::string n = + std::string( get_typename::name() )+","+ + std::string( get_comma_separated_typenames< Ts... >::names() ); + return n.c_str(); + } + }; + + template< typename... T > + struct get_typename< static_variant< T... > > + { + static const char* name() + { + static const std::string n = std::string( "fc::static_variant<" ) + + get_comma_separated_typenames::names() + + ">"; + return n.c_str(); + } + }; + } // namespace fc