I want a ostream with a prefix at the beginning of every line redirected on cout; I try this:
#include
#include
class paralle
Your output operator is returning a reference to the base class (std::ostream
), which means that the next call to operator <<
will not use your implementation.
Changing your output operator to this should fix your problem:
template
parallel_cout& operator<< (const T& val)
{
out << "prefix " << val;
return *this;
}