void Message::put_Msg_in_Folders(const set &rhs)
{
for(std::set::const_iterator beg = rhs.begin();
beg != rhs.end(); ++beg)
(*beg)->addMsg(this); // beg points to a Folder
}
个人对(*beg)返回值理解为(string * const &),只是不知道对不对,只有这样才能修改rhs中Foler所指向的对象。rhs为const对象,则rhs不可增加或减少元素个数,rhs的元素也应为const,可上面程序就是改变了元素值,不能求理解,大侠帮忙解释一下。
关于C++primer第四版中message示例中中const_iterator的疑问
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-