我在使用 GNU g++ 4.9.2 编译以下代码片段时遇到问题(用于在 g++ 2.95.3 中正常编译)
XOStream &operator<<(ostream &(*f)(ostream &)) {
if(f == std::endl) {
*this << "\n" << flush;
}
else {
ostr << f;
}
return(*this);
}
错误如下:
error: assuming cast to type 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)' from overloaded function [-fpermissive]
[exec] if(f == std::endl) {
[exec] ^
请指导/帮助。