我有一个会员是std::ofstream fBinaryFile
and a
void setFile( std::ofstream& pBinaryFile )
{
fBinaryFile = pBinaryFile;
}
output:
Data.h:86:16: error: use of deleted function ‘std::basic_ofstream<char>& std::basic_ofstream<char>::operator=(const
std::basic_ofstream<char>&)’
fBinaryFile = pBinaryFile;
^
我明白了,复制std::ofstream
是不允许的,也许我错过了一些东西。是否可以保存内容pBinaryFile
in fBinaryfile
?
因为相关运算符被声明为
ofstream& operator= (const ofstream&) = delete;
这意味着它是被明确禁止的ofstream
语义确实支持复制。
根据您的体系结构,您可以存储指针/引用或移动它。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)