wiebe@june.cs.washington.edu (Doug Wiebe) (07/28/88)
Here's a very simple solution to a very minor problem...
I got tired of doing the following to flush output streams:
if (i == j) {
cout << "i = " << i;
cout.flush();
}
Now I just write:
if (i == j)
cout << "i = " << i << FLUSH;
In my utilities library, I've defined the following:
class StreamFlush { };
const StreamFlush FLUSH;
ostream&
operator<<(ostream& out, StreamFlush)
{
out.flush();
return out;
}
What other tricks do you C++ hackers use to make your lives easier?
--
wiebe@cs.washington.edu Doug Wiebe
{ihnp4,decvax,ucbvax}!uw-beaver!wiebe Dept. of Computer Science, FR-35
University of Washington
Phone: 206-543-8993 Seattle, WA 98195