我有一个看起来像这样的结构:
sturct person
{
string surname;
person(string n) : surname(n) {};
}
我需要operator<<
为std::ostream
and重载person
。我写了这个函数:
std::ostream operator<<(std::ostream & s, person & os)
{
s << os.surname;
return s;
}
但我收到此错误:
/usr/include/c++/4.6/bits/ios_base.h|788|错误:'std::ios_base::ios_base(const std::ios_base&)' 是私有的|
/usr/include/c++/4.6/bits/basic_ios.h|64|error:在此上下文中
/usr/include/c++/4.6/ostream|57|注意:这里首先需要综合方法'std::basic_ios::basic_ios(const std::basic_ios&)' |