
So, what I want is something to say insert a carriage-return before calling operator<<, e.g. SMART_ASSERT( this==that )(prefix_cr(brd))(this)(that);
Why not something like: ...
Thanks! That worked.
Is there a more general version of the problem?
I don't know - I cannot remember needing to prefix anything other than a carriage-return. I need to indent a 2d output sometimes (e.g. in trace logs to show the depth of recursion) but that requires a prefix to each line so is a different kind of problem. Darren --------------------------------------- template<typename T> struct cr_prefixed { cr_prefixed(T& t) : t(t) { } void print(std::ostream& out) const { out << "\n" << t; } T& t; }; template<typename T> std::ostream& operator<<(std::ostream& out, const cr_prefixed<T>& p) { p.print(out); return out; } template<typename T> cr_prefixed<T> prefix_cr(T& t) { return cr_prefixed<T>(t); }