Predicate function for deleting vector elements

Hi,


vObjects.erase(std::remove_if(vObjects.begin(), vObjects.end(), [](wzSolId) { return wzId == object.m_Id }), vObjects.end());


I have a vObjects vector<objects> and I am looking to delete objects with specific Id. Above is the code I am using. But the compiler doesn't recognize "object". How do I filter out objects with specific Id?

Thanks.
> But the compiler doesn't recognize "object"
It's low on magic.

Perhaps something like
1
2
3
4
5
6
7
8
9
10
vObjects.erase(
	std::remove_if(
		vObjects.begin(),
		vObjects.end(),
		[wzId](const objects &object){
			return wzId == object.m_Id;
		}
	),
	vObjects.end()
);

Note `wzId' being captured, and specifying the parameter (may use `auto' with c++14)
Topic archived. No new replies allowed.