you mean that doing cout<<'\n'; instead of cout<<endl; makes your program faster?
I'd say it makes your program more rational. Much of popularity of endl comes from early erroneous textbooks that called endl "portable end of line", with '\n' being somehow "not portable", and many people took that as truth.
@Peter87: Why would you create a stream inside the function? You already have all the streams defined, and even if you don't know what stream to use, you can do this:
1 2 3 4 5 6 7 8 9 10 11 12 13
/* yadda yadda yadda, declare function name...
then when it comes to returning, */
switch (typeid(/*the type of the stream to return*/))
{
casetypeid(ostream):
/*the type of the stream to return*/& stm=cout;
casetypeid(ofstream):
/*you know what*/&& shm=ofstream();
casetypeid(istringstream):
/*uhhh*/&& stm=istringstream();
}
return stm;
}