遇到一个比较奇异的错误

幻夢之葉 幻夢之葉 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
error C2678: binary '=' : no operator found which takes a left-hand operand of type 'const std::string' (or there is no acceptable conversion)

VS2008

奇异不在错误本身,而是我声明一个成员变量

//.h
std::string m_men;

//.cpp
std::string::size_type index = m_men.find_first_not_of(" ");
m_men = (std::string)m_men.substr(index); // C2678
//同
//std::string strTemp = (std::string)m_men.substr(index);
//m_men = strTemp; // C2678


这是什么原因造成的错误?如何会让string类型变化为const string?
...全文

相关推荐

评论 8
收藏 已收藏
分享
返回顶部
幻夢之葉
C++ 语言 65,214 成员 250,514 内容