1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream> class Report { public: Report& operator<<(const char *text) { std::cout << text << std::flush; return *this; } }; int main() { Report r; r << "hello world\n" << "foo " << "bar"; return 0; }
1 2
hello world foo bar