#include #include #include "printable.h" using namespace std; template struct stream { static basic_ostream& r; }; template <> basic_ostream& stream::r = cout; template <> basic_ostream& stream::r = wcout; template void f() { try { basic_printable p = static_cast('A'); stream::r << ++p << static_cast('\n'); p = static_cast('\0'); } catch (const except& e) { cerr << e.what() << "\n"; } stream::r << flush; } int main() { f(); f(); return EXIT_SUCCESS; }