26 #ifndef CASADI_PRINTABLE_HPP
27 #define CASADI_PRINTABLE_HPP
30 #pragma GCC diagnostic push
31 #pragma GCC diagnostic ignored "-Wnonnull"
35 #pragma GCC diagnostic pop
43 #include "casadi_common.hpp"
61 template<
class Derived>
66 std::ostream&
operator<<(std::ostream &stream,
const Derived& obj) {
72 inline friend std::string
repr(
const Derived& obj) {
73 return Derived::type_name() +
"(" + obj.get_str() +
")";
Base class for objects that have a natural string representation.
friend std::ostream & operator<<(std::ostream &stream, const Derived &obj)
Print a string representation of the object to a stream.
friend std::string repr(const Derived &obj)
Get string representation with type information.