Reputation: 17
i've got some problem/ i don't understand something and it cause this problem :)
Here is some code:
list<Walec>lista;
remove_copy_if(vec.begin(),vec.end(), lista.begin(),Warunek_na_Wysokosc(sredniasu));
copy(lista.begin(),lista.end(),ostream_iterator<Walec>(cout, " \n"));
And here is Warunek_Na_Wysokosc definition:
struct Warunek_na_Wysokosc
{
double wys;
Warunek_na_Wysokosc(const double& h_): wys(h_){ }
bool operator()(const Walec& w)
{
return w.h >= wys;
}
};
The thing is i get some memory problems if i let it be like that, i mean instructions in main function, and there are none if i set list size. But i want it to be set automatically, should i use some insert function? How to correct this? :) Thanks!
Upvotes: 0
Views: 141