Consider something like ...
template<typename T>
class Vector {
...
bool operator==( const Vector<float> &rhs ) {
}
bool operator==( const Vector<T> &rhs ) {
}
...
};
Please note that specialization is above the non-specialized version. If I put the specialized version below the non-specialized version, would the comparison Vector<float>== still work as intended? For some reason, I think I remember reading that if you put the specialization below in this scenario, then when the compiler looks at the header, it will see by default, see that it works, and use it.
source
share