pretty_name.h
Go to the documentation of this file.
#ifndef _RHEOLEF_PRETTY_NAME_H
#define _RHEOLEF_PRETTY_NAME_H
#include "rheolef/compiler.h"
#include <typeinfo>
namespace rheolef {
/*Class:man
NAME: @code{typename_macro}, @code{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.
@code{typeid_name_macro} obtains a human readable type in a @code{std::tring} form
by calling the system @code{typeid} function and then a demangler.
When this type is very long, @code{pretty_name_macro} prints also it in a multi-line
form with a pretty indentation.
EXAMPLES:
@example
typedef map <size_t, double, less<size_t>, heap_allocator<pair<size_t,double> > > map_type;
cout << typeid_name_macro (map_type);
@end example
AUTHORS:
LJK-IMAG, 38041 Grenoble cedex 9, France
| Pierre.Saramito@imag.fr
DATE: 15 december 2010
End:
*/
//<verbatim:
extern std::string typeid_name (const char* name, bool do_indent);
} // namespace rheolef
#define typename_macro(T) rheolef::typeid_name(typeid(T).name(), false)
#define pretty_typename_macro(T) rheolef::typeid_name(typeid(T).name(), true)
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); }
//>verbatim:
#endif // _RHEOLEF_PRETTY_NAME_H
T
Expr1::float_type T
Definition: field_expr.h:261
mkgeo_contraction.name
string name
Definition: mkgeo_contraction.sh:133
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::typeid_name
std::string typeid_name(const char *name, bool do_indent)
Definition: pretty_name.cc:78
pretty_typename_of
std::string pretty_typename_of(T x)
Definition: pretty_name.h:59
typename_of
std::string typename_of(T x)
get string type from a variable or expression
Definition: pretty_name.h:58