In a comparison operator:
template
bool operator==(Manager m1, Manager m2) {
return m1.internal_field == m2
I must admit, I don't see the motivation behind this, particularly if it requires writing shedloads of supporting code. For your operator:
template
bool operator==(Manager m1, Manager m2) {
return p1.internal_field == p2.internal_field;
}
to compile without a warning, both template parameter types must be capable of being parameters to the Manager template, and those types must have private members (I assume p1 & p2 should be m1 & m2) called internal_field. Given those constraints, what is the chance that this template function can be called by accident on the wrong type(s)?