I donβt know what I know.
std::endl is a function that takes a stream and returns a stream:
ostream& endl ( ostream& os );
When you apply it to std::cout , it will immediately apply this function.
On the other hand, std::basic_ostream has an operator<< overload with a signature:
template <typename C, typename T> basic_ostream<C,T>& operator<<(basic_ostream<C,T>& (*pf)(basic_ostream<C,T>&));
which will also immediately apply this function.
So technically, there is no difference, although the stream std::cout << std::endl more idiomatic. Perhaps the judge-bot is simplified and does not understand this.
source share