我有下面的类(prototipe):C++的std :: stringstream的运营商<<重载
class Token
{
public:
//members, etc.
friend std::stringstream& operator<< (std::stringstream &out, Token &t);
};
且操作者实施这样的:
std::stringstream & operator<< (std::stringstream &out, Token &t)
{
out << t.getValue(); //class public method
return out;
}
现在,我想使用这样的:
std::stringstream out;
Token t;
//initialization, etc.
out << t;
而且VS给了我的错误,说是有敌不过< <运营商。我在错什么?
欢迎SO。当您提供代码示例时,请保留一份可编译的代码。并*总是*给出完整的编译器错误。 – thiton 2012-01-12 11:11:49