There is a class "Camera". It has a static list of all the cameras created:
private:static std::vector<Camera> cameras;
In the constructor of this class, I put "myself" (this) in this list like this:
Camera::cameras.push_back(*this); I want to remove "myself" from this list in the destructor. Trying to do this:
cameras.erase(std::find(cameras.begin(), cameras.end(), *this)); Gives a compilation error:
Ошибка C2678 бинарный "==": не найден оператор, принимающий левый операнд типа "Camera" (или приемлемое преобразование отсутствует) What am I doing wrong? I think you need to redefine the operator == to compare two cameras. But is that the problem?
std::vector<Camera*>and.push_back(this);- gil9red==so that the vector can compare as objects. - gil9red