Templates and generic programming
T.83
Do not declare a member function template virtual
Reason
C++ does not support that. If it did, vtbls could not be generated until link time. And in general, implementations must deal with dynamic linking.
Example, don't
class Shape {
// ...
template<class T>
virtual bool intersect(T* p); // error: template cannot be virtual
};
Note
We need a rule because people keep asking about this
Alternative
Double dispatch, visitors, calculate which function to call
Enforcement
The compiler handles that.