下面是来自 stlport 的 endl 函数。
template <class _CharT, class _Traits>
inline basic_ostream<_CharT, _Traits>& _STLP_CALL
endl(basic_ostream<_CharT, _Traits>& __os) {
__os.put(__os.widen('\n'));
__os.flush();
return __os;
}
在使用endl的时候,我们可能会有这样的代码:
std::cout<<"Hello World!"<<std::endl;
没有 (),std::endl 如何工作?
或者我的问题是“没有 operator() 的函数如何执行?”