Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <stdio.h>
- using namespace std;
- struct Printer
- {
- template<typename T>
- Printer& operator+(T arg)
- {
- Stream << arg;
- return *this;
- }
- Printer& operator+(Printer& (*arg)(Printer&))
- {
- arg(*this);
- return *this;
- }
- void Flush()
- {
- printf("%s\n", Stream.str().c_str());
- Stream.str("");
- }
- stringstream Stream;
- };
- Printer& pend (Printer & print)
- {
- print.Flush();
- return print;
- }
- int main()
- {
- Printer print;
- print+"Hello "+"world"+pend;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement