Namespaces | Classes | Typedefs | Functions
Pretty Type

Pretty printing of types. More...

Namespaces

 pretty_type
 Contains all functions that are part of PrettyType, used for printing types in a pretty manner.
 

Classes

struct  pretty_type::stl_templates
 A list of type traits to check if something is an STL member. More...
 

Typedefs

using pretty_type::basics_map = detail::TemplateMap_t< char, signed char, unsigned char, wchar_t, char16_t, char32_t, int, unsigned int, long, unsigned long, long long, unsigned long long, short, unsigned short, float, double, long double, bool, std::string >
 typelist of basic types that can be pretty printed More...
 

Functions

template<typename T , typename Map = basics_map, typename KnownTemplates = stl_templates>
std::string pretty_type::get_name ()
 Returns a string with the prettiest typename known for the type T. More...
 
template<typename T >
std::string pretty_type::get_runtime_type_name (const T &x)
 Returns a string with the prettiest typename known for the runtime type of x. More...
 
std::string pretty_type::extract_short_name (std::string name)
 Extract the "short name" from a name, that is, the name without template parameters or scopes.
 
template<typename T >
std::string pretty_type::short_name ()
 Return the "short name" of a class, that is, the name without template parameters or scopes.
 

Detailed Description

Pretty printing of types.

Typedef Documentation

◆ basics_map

using pretty_type::basics_map = typedef detail::TemplateMap_t<char, signed char, unsigned char, wchar_t, char16_t, char32_t, int, unsigned int, long, unsigned long, long long, unsigned long long, short, unsigned short, float, double, long double, bool, std::string>

typelist of basic types that can be pretty printed

These are specializations of tt::Type<T>

Function Documentation

◆ get_name()

template<typename T , typename Map = basics_map, typename KnownTemplates = stl_templates>
std::string pretty_type::get_name ( )

Returns a string with the prettiest typename known for the type T.

Example usage: auto name = get_name<T>();

Template Parameters
Tthe type to print
Mapa tmpl::map of basic types (non-containers) and their Type<T> specializations that determine how to print the type name in a pretty form
KnownTemplatesstruct hold template alias tmpl::list of is_... that are known how to be printed pretty

Returns: std::string containing the typename

◆ get_runtime_type_name()

template<typename T >
std::string pretty_type::get_runtime_type_name ( const T &  x)

Returns a string with the prettiest typename known for the runtime type of x.

The result will generally not be as pretty as the result of get_name, but this function will report the derived type of a class when only given a base class reference, which get_type cannot do.