std::remove calls operator==
, you need to overload it for your User type
:
assume you compare User by name:
bool operator==(const User& lhs, const User& rhs)
{
return lhs.name == rhs.name;
}
If you read carefully, compiler message tells you what exactly is missing.
Alternatively use std::remove_if with lambda if you use C++11
myVec.erase(std::remove(myVec.begin(), myVec.end(),
[](const User& u){ return u.name == "name"; }), vec.end());