diff --git a/include/boost/core/type_name.hpp b/include/boost/core/type_name.hpp index d31750b..df13e8e 100644 --- a/include/boost/core/type_name.hpp +++ b/include/boost/core/type_name.hpp @@ -344,7 +344,7 @@ template std::string type_name( tn_identity, std::string const& su #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -template std::string type_name( tn_identity, std::string const& suffix ) +template std::string function_type_name( tn_identity, std::string const& trailer, std::string const& suffix ) { std::string r = type_name( tn_identity(), "" ); @@ -354,12 +354,141 @@ template std::string type_name( tn_identity, std:: } r += '(' + tn_add_each() + ')'; + r += trailer; return r; } +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), "", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " volatile", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const volatile", suffix ); +} + +#if !defined(BOOST_NO_CXX11_REF_QUALIFIERS) + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " &", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const &", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " volatile &", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const volatile &", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " &&", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const &&", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " volatile &&", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const volatile &&", suffix ); +} + #endif +#if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " noexcept", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const noexcept", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " volatile noexcept", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const volatile noexcept", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " & noexcept", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const & noexcept", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " volatile & noexcept", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const volatile & noexcept", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " && noexcept", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const && noexcept", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " volatile && noexcept", suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const volatile && noexcept", suffix ); +} + +#endif + +#endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + // pointers template std::string type_name( tn_identity, std::string const& suffix ) diff --git a/test/type_name_test.cpp b/test/type_name_test.cpp index ebd3895..71a2221 100644 --- a/test/type_name_test.cpp +++ b/test/type_name_test.cpp @@ -124,6 +124,44 @@ int main() TEST(void(&&)()); #endif + + TEST(void() const); + TEST(void() volatile); + TEST(void() const volatile); + +#if !defined(BOOST_NO_CXX11_REF_QUALIFIERS) + + TEST(void() &); + TEST(void() const &); + TEST(void() volatile &); + TEST(void() const volatile &); + + TEST(void() &&); + TEST(void() const &&); + TEST(void() volatile &&); + TEST(void() const volatile &&); + +#endif + +#if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) + + TEST(void() noexcept); + TEST(void() const noexcept); + TEST(void() volatile noexcept); + TEST(void() const volatile noexcept); + + TEST(void() & noexcept); + TEST(void() const & noexcept); + TEST(void() volatile & noexcept); + TEST(void() const volatile & noexcept); + + TEST(void() && noexcept); + TEST(void() const && noexcept); + TEST(void() volatile && noexcept); + TEST(void() const volatile && noexcept); + +#endif + #endif TEST(A[]);