How to erase all values from vector of struct, where struct value k equals to 0?
struct tabuRecord {
int x;
int y;
int k;
tabuRecord( int x, int y, int k)
: x(x), y(y), k(k){}
};
vector <tabuRecord> tabu;
v.insert(v.begin(), tabuRecord(1, 2, 3));
v.insert(v.begin(), tabuRecord(4, 5, 0));
v.insert(v.begin(), tabuRecord(7, 8, 9));
v.insert(v.begin(), tabuRecord(10, 11, 0));
I have tried to
tabu.erase(std::remove(tabu.begin(), tabu.end(), tabu.k=0), tabu.end());
and
tabu.erase(std::remove(tabu.begin(), tabu.end(), tabuRecord.k=0), tabu.end());