I'm having an annoying issue with my code. I created class named box. In that class there is a vector of another class, lipids. For that class, I overloaded the == operator by comparing the two vectors. Even though I got no error message on the operator== declaration, I still get error message when I try to use it. I have attached my box.cpp code. The bolded line is the line that cause the compilation error.
On that point, I tried to understand the logic behind the cons usage in the operator overload and I coulsdn't see any. As far as I understand, const means that I cannot change the value inside the argument, am I right?
const ensures that the data cannot be changed through the reference. These functions are read-only so you want to write const correct code so that accidental modification of the data will result in a compiler error.