嗨,我试图重载运算符<<钩入
stream << std::endl;
以避免在不需要输出时追加'n'。我已经重载了:
std::ostream& operator<< (std::ostream& (*pf)(std::ostream&))
std::ostream& operator<< (std::ios& (*pf)(std::ios&))
std::ostream& operator<< (std::ios_base& (*pf)(std::ios_base&))
但是调用总是在basic_ostream
结束_Myt& __CLR_OR_THIS_CALL operator<<(_Myt& (__cdecl *_Pfn)(_Myt&))
{// call basic_ostream manipulator
_DEBUG_POINTER(_Pfn);
return ((*_Pfn)(*this));
}
自己找到解决办法
问题是其他重载操作符返回std::ostream&