Kagamin wrote:
Frits van Bommel Wrote:

That's the difference. You can't fold templates because they're binary 
incompatible as opposite to generics.
They're not always binary-incompatible. For instance, if a template only works with pointers or references (this includes object references) to parameter types it might well contain the exact same machine code for some of the instantiations.

If you require that the class inherits some interface and call that interface's 
methods, they'll be incompatible. I'll dare to say this is the most useful 
variant of generic code.

Okay, so it doesn't (usually) work for interfaces, but it'll work if the requirement is for a common base class. Or perhaps even if they happen to have a common base class that implements the interface in question.

Reply via email to