it started to work as magic. thanks everybody.
Hello,
firstly-
std::vector <LCDRange *>::iterator it;
LCDRange *l;
for (it=vec->begin();it!=vec->end();it++) { // is executed N
times
l=*(it);
l->p_doba->list();
l->p_doba->checkSanity(l->day->day,t);
l->p_doba->show_ListOfWorkingSchedule(t);
}
in checkSanity i call
this->add(1,10,"i am desperate",t);
which does
SD sd;
sd.from=first;
sd.to=last;
ListOfWorkingSchedule.insert(std::make_pair(sd,typ)); //typ=="i am
desperate"
so far so good
but show_ListOfWorkingSchedule(t) contains
std::map<SD,std::string>::iterator itd;
int a,b; SD s;
for(itd = ListOfWorkingSchedule.begin(); itd !=
ListOfWorkingSchedule.end(); itd++)
{ s=itd->first;
a=s.return_from();
b=s.return_to();
std::cout << a << " " << itd->second << std::endl; //is
executed N times instead of how many items have been added
}
Frank Birbacher napsal(a):
Hi!
Milan Krejci schrieb:
Thanks! now it works only another issue has raised. when i try to list
my map it is executed way too many times for no apparent reason.
sd=new SD();
sd->from=first;
sd->to=last;
SDoby.insert(std::make_pair(*sd,typ));
Try to avoid "new":
SD sd;
sd.from = first;
sd.to = last;
SDoby.insert(std::make_pair(sd,typ));
std::cout << a << " " << it->second << std::endl; //executed way
more times than is supposed to be
How many times did it execute? How many times should it execute? It's
best to provide the output your program gives AND to provide what you
expected.
Frank