I'm reading
Primer C++ > Adventures in Functions > Templates > Explicit Specialization.
To show the reason/use for Explicit Specialization, a case is illustrated:
Consider a swap template function that can swap any type (int, double, struct
etc...)
But there is a specific struct job
that you want to only swap two members of, and leave the rest of the members as they are. You will need a different definition, and so you will have to make an Explicit Specialization.
There is this statement in the same section:-
"A specialization overrides the regular template, and a non-template function overrides both."
Why not just make a regular function for that use? Then a regular/non-template will override the template, isn't it?
If my solution is correct, then what is a good example for Explicit Specialization?