.\" .de Id .. .de Sp .if n .sp .if t .sp 0.4 .. .TH pretty_name 8rheolef "rheolef-6.7" "rheolef-6.7" "rheolef-6.7" .\" label: /*Class:man .SH NAME \fBtypename_macro\fP, \fBpretty_typename_macro\fP - type demangler and pretty printer .SH DESCRIPTION These preprocessor macro-definitions are usefull when dealing with complex types as generated by imbricted template technics: they print in clear a complex type at run-time. \fBtypeid_name_macro\fP obtains a human readable type in a \fBstd::tring\fP form by calling the system \fBtypeid\fP function and then a demangler. When this type is very long, \fBpretty_name_macro\fP prints also it in a multi-line form with a pretty indentation. .SH EXAMPLES .\" begin_example .Sp .nf typedef map , heap_allocator > > map_type; cout << typeid_name_macro (map_type); .Sp .fi .\" end_example .\" skip start:AUTHORS: .\" skip start:DATE: .\" END .SH IMPLEMENTATION .\" begin_example .Sp .nf 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 std::string typename_of (T x) { return typename_macro(T); } template std::string pretty_typename_of (T x) { return pretty_typename_macro(T); } .Sp .fi .\" end_example