¡¾ÇóÖú¡¿¹ØÓÚconst_iteratorÓëiteratorת»»
¸÷λ´óϺºÃ£ºÐ¡µÜÓöµ½Á˸öÄÑÌ⣬Çó½Ì¸÷λ´óϺ¡£
ÔÚTurbolinux10ÉϱàÒëʱ³öÏÖÈçÏ´íÎó£º
error: invalid use of const_cast with type `__gnu_cxx::__normal_iterator<TopicUnit*, std::vector<TopicUnit, std::allocator<TopicUnit> > >', which is not a pointer, reference, nor a pointer-to-data-member type
error: invalid const_cast from type `__gnu_cxx::__normal_iterator<const TopicUnit*, std::vector<TopicUnit, std::allocator<TopicUnit> > >' to type `__gnu_cxx::__normal_iterator<TopicUnit*, std::vector<TopicUnit, std::allocator<TopicUnit> > >'
ÆäÖгö´íµÄ´úÂëÊÇ
for ( TopicUnitList::const_iterator tu = tu_list.begin(); tu != tu_list.end(); tu++) {
ins_result = topics.insert(const_cast<TopicUnitList::iterator>(tu)->getMatchTopicTitle().topicTitle->getTopic());
if (ins_result.second) new_tu_list.push_back(*tu);
}
лл¸÷λ:p :eek:
Ò³:
[1]