The error message is pretty clear: the compiler is looking for an operator == function that compares two machines. The signature of such a method, if it existed, would be something like
bool operator==(const Vehicle& first, const Vehicle& second);
What is not so clear why this is happening. After all, you are not using the == operator anywhere in your code! Crummy compiler - complaining about something you didn't even do.
To understand what is going on, you must understand the “find” method. This is a boilerplate method, and in C ++, templates are quite diverse find-and-replace text (warning: massive simplification!). The code for the "search" will be generated on the fly for the types that you use immediately before starting the compiler.
You can check how the search is done here . In the unlikely event that cplusplus.com ever goes offline, I have included the relevant part below *:
template<class InputIterator, class T> InputIterator find (InputIterator first, InputIterator last, const T& val) { while (first!=last) { if (*first==val) return first;
Where it comes from ==; The compiler will automatically generate a search code for your type (vehicle). Then, when it goes to compilation, this generated code tries to use the == operator, but not for the vehicle. You will need to provide you with your car.
* Seriously though - check out this site . He shows you how it all works.
source share