std::endl is a template function, why can we use it without ()?

59 Views Asked by At

Below is the endl function from stlport.

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;
}

When using endl, we may have this kind of code:

std::cout<<"Hello World!"<<std::endl;

How does std::endl work without ()?

Or my question is "How does function execute without operator()?"

0

There are 0 best solutions below