Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
pretty_name.h
Go to the documentation of this file.
1#ifndef _RHEOLEF_PRETTY_NAME_H
2#define _RHEOLEF_PRETTY_NAME_H
23
24#include "rheolef/compiler.h"
25#include <typeinfo>
26
27namespace rheolef {
28
29/*Class:man
30NAME: @code{typename_macro}, @code{pretty_typename_macro} - type demangler and pretty printer
31DESCRIPTION:
32 These preprocessor macro-definitions are useful when dealing with complex types
33 as generated by imbricted template technics: they print in clear a complex type at run-time.
34 @code{typeid_name_macro} obtains a human readable type in a @code{std::tring} form
35 by calling the system @code{typeid} function and then a demangler.
36 When this type is very long, @code{pretty_name_macro} prints also it in a multi-line
37 form with a pretty indentation.
38EXAMPLES:
39 @example
40 typedef map <size_t, double, less<size_t>, heap_allocator<pair<size_t,double> > > map_type;
41 cout << typeid_name_macro (map_type);
42 @end example
43AUTHORS:
44 LJK-IMAG, 38041 Grenoble cedex 9, France
45 | Pierre.Saramito@imag.fr
46DATE: 15 december 2010
47End:
48*/
49//<verbatim:
50extern std::string typeid_name (const char* name, bool do_indent);
51} // namespace rheolef
52
54#define typename_macro(T) rheolef::typeid_name(typeid(T).name(), false)
55#define pretty_typename_macro(T) rheolef::typeid_name(typeid(T).name(), true)
56
58template <class T> std::string typename_of (T x) { return typename_macro(T); }
59template <class T> std::string pretty_typename_of (T x) { return pretty_typename_macro(T); }
60//>verbatim:
61
62#endif // _RHEOLEF_PRETTY_NAME_H
Expr1::float_type T
Definition field_expr.h:230
This file is part of Rheolef.
std::string typeid_name(const char *name, bool do_indent)
std::string pretty_typename_of(T x)
Definition pretty_name.h:59
std::string typename_of(T x)
get string type from a variable or expression
Definition pretty_name.h:58