plz help me for this error and … (visual studio 2010)
void file_remove(u32 id, int action) {
file f;
f.id = id;
**file_set::iterator i = fs.find(f);**
if(i == fs.end()) return;
// move cursor away
if(conf.expose.cursor == id) cursor_down();
if(conf.expose.cursor == id) cursor_up();
if(conf.expose.cursor == id) conf.expose.cursor = 0;
if(action != 1 && i->size >= conf.files.incomp_min_size &&
(u64)segment_summ(i->seg) * 100 / i->size >= conf.files.incomp_percent)
{ action = 2; }
char n1[0x100];
char n2[0x100];
if(!i->deleted){
cache_close(i->h);
snprintf(n1, sizeof(n1), "%s/%s", conf.fnames.dir_temp, i->name.c_str());
if(action == 0)
{ // just close
}
else if(action == 1)
{
snprintf(n2, sizeof(n2), "%s/%s", conf.fnames.dir_ok, i->name.c_str()); seg(*i, conf.fnames.dir_temp, false);
cache_move(n1, n2);
}
else if(action == 2)
{
snprintf(n2, sizeof(n2), "%s/%s", conf.fnames.dir_incomplete, i->name.c_str());
seg(*i, conf.fnames.dir_incomplete, true, true);
seg(*i, conf.fnames.dir_temp, false);
cache_move(n1, n2);
}
else if(action == -1)
{
seg(*i, conf.fnames.dir_temp, false);
cache_move(n1, ""); // unlink
}
} else {
ffs_remove(i->size, i->tag);
fs.erase(i);
sort_files();
return;
}
if(!i->tmp){
ffs_remove(i->size, i->tag);
fs.erase(i);
} else {
**i->deleted = true;**
}
sort_files();
}
compile it and error with this element : i->deleted = true; + view this result
1>main.cpp(478): error C3892:
‘std::_Tree_unchecked_const_iterator<_Mytree,_Base>::operator ->’ :
you cannot assign to a variable that is const 1> with 1>
[ 1>
_Mytree=std::_Tree_val,std::allocator,false>>,
1> _Base=std::_Iterator_base 1> ]
http://up.vbiran.ir/images/w21nnbxc7tf5okzk0lr.png
http://up.vbiran.ir/images/x0coajrixr764g49ibeh.png
plz help me for resolve this error
Yes, it is this line that is the problem
In a
std::setall the elements are const (because changing the value might invalidate the order of the set).