I have to write an extension of basic_stringstream class, and I'm facing some difficulties with endl() function.

Here is my code

class Logger: public basic_stringstream<TCHAR> {

inline Logger& __cdecl endl(Logger& _Ostr) {
	// Original code in ostream
	return (_Ostr);

int main() {
	Logger test;
	test << "a" << endl << "b" << endl;
	std::cout << test.str() << endl;

However, the result is something like:


The function is not executed but instead its address was inserted.
I don't know how to get around this problem. Can anyone help me on this?

Thank you in advance.

I figured out the problem
Just replace endl() by:

inline basic_ostream<TCHAR>& __cdecl endl(basic_ostream<TCHAR>& _Ostr)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.