std::endl

Why this code report me this error??
Overload function with no contextual type information.

It isn't a function's overload...

prototype: ostream& endl (ostream& os);

 
(*endl)(cout);
Last edited on
Actually endl is a function. the ostream operator << accepts a function of that type.

Read this:
http://www.cplusplus.com/reference/ostream/ostream/operator%3C%3C/
Prototype:
1
2
template< class CHAR_TYPE, class TRAITS_TYPE >
std::basic_ostream< CHAR_TYPE, TRAITS_TYPE >& std::endl( std::basic_ostream< CHAR_TYPE, CHAR_TYPE >& ) ;


Either: std::endl( std::cout ) ; // types are deduced

Or: ( *std::endl< char, std::char_traits<char> > )(std::cout) ;
Topic archived. No new replies allowed.