Ad Q1:
I would recommend a little against this. Exceptions must be completed when the caller, who ultimately handles the exception, does not need to know about the internal details, and the original exception does not make sense. But for operator<< throwing std::ios_base::failure makes sense, so I wonβt wrap it here.
Ad Q2:
No, but you can do something like:
Logpp& do_output(std::ostream& (*manip)(std::ostream&)) { *p_Stream << manip; return *this; } Logpp& operator<<(std::ostream& (*manip)(std::ostream&)) { return wrap_exception(&Logpp::do_output, this, manip); }
(maybe a little easier to use bind from TR1 / Boost as
return wrap_exception(bind(&Logpp::do_output, this, manip));
source share