[Solved] How does template specialisation work?


This is no specialization, this is instanciation.

Templates are managed in two passes.

The first is almost syntactic; the compiler just verifies if the code looks like something correct.

Then when you use the template (instanciate it) with the given or deduced types, it tries to generate the code (if not already done), so when it encounters a+b it just tries to find the appropriate operator for the involved types. If not found, an error is emitted, else code is (eventually, some other errors may happen) emitted.

3

solved How does template specialisation work?