Class template Dune::XT::Common::Printer¶
-
template<class T, bool use_repr = false, typename anything = void>
class Dune::XT::Common::Printer¶ Specialize this class for your type to benefit from the print() and repr() functions.
Any specialization of Printer is expected to have the following print() method void print(std::ostream & out) const { if (use_repr) this->repr(out); else this->str(out); } the behaviour of which is supposed to change with use_repr. A possible implemenation is given in internal::DefaultPrinter, based on the following two methods: void repr(std::ostream & out) const { out < < “detailed and unambiguous description”; }
void str(std::ostream & out) const { out < < “compact and readabale description”; } It is therefore recommended to derive from internal::DefaultPrinter or internal::VectorPrinter, where some of this is already provided.
Similar to python, one can use repr(obj) to obtain an unambigous representation of obj (with as much detail as possible), while print(obj) mimics Pythons str to obtain a compact and readable representation of obj.
See also:
internal::DefaultPrinter,print,repr
-
template<>
Dune::XT::Common::Printer::Printer<T, use_repr, anything>(const T &val, const Configuration ¶m = {})¶ No documentation provided.