---
name: "pretty_name"
section: "8rheolef"
platform: "linux"
package: "librheolef-dev"
version: "7.0-2+b1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/pretty_name"
---

# pretty\_name(8rheolef)

type demangler and pretty printer

## NAME

**typename\_macro**, **pretty\_typename\_macro** - type demangler and pretty printer

## DESCRIPTION

These preprocessor macro-definitions are useful when dealing with complex types as generated by imbricted template technics: they print in clear a complex type at run-time. **typeid\_name\_macro** obtains a human readable type in a **std::tring** form by calling the system **typeid** function and then a demangler. When this type is very long, **pretty\_name\_macro** prints also it in a multi-line form with a pretty indentation.

## EXAMPLES

```
  typedef map <size_t, double, less<size_t>, heap_allocator<pair<size_t,double> > >  map_type;
  cout << typeid_name_macro (map_type);

```

## IMPLEMENTATION

```
extern std::string typeid_name (const char* name, bool do_indent);
} // namespace rheolef
/// @brief get string from a type, with an optional pretty-printing for complex types
#define        typename_macro(T) rheolef::typeid_name(typeid(T).name(), false)
#define pretty_typename_macro(T) rheolef::typeid_name(typeid(T).name(), true)
/// @brief get string type from a variable or expression
template <class T> std::string        typename_of (T x) { return        typename_macro(T); }
template <class T> std::string pretty_typename_of (T x) { return pretty_typename_macro(T); }

```

## COPYRIGHT

Copyright (C) 2000-2018 Pierre Saramito \<Pierre.Saramito@imag.fr\> GPLv3+: GNU GPL version 3 or later \<http://gnu.org/licenses/gpl.html\>. This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.
