c++ execute function any time a stream is written to
问题 I have a simple GUI program that uses a custom stringstream to redirect output from the console to a text field in the GUI (under some circumstances). currently. the window redraws any time I hit enter, but it's possible that output could be generated at other times. Is there a way to register a function with the stringstream that gets executed every time the << operator is used on the stream? NOTE I should have pointed out that I cannot use C++11 in my solution. the machines on which this