Ex 65 can be a little surprising if you have overloads of debug_rep for char * and const char * compiled together with the specializations: you can't get the specializations to be called to save your life.
Of course the book says as much:
Specializations instantiate a template; they do not overload it. As a result, specializations do not affect function matching.
However, it's already a big book (so much for a "primer" 🥲), and it's easy to just skim over this important detail.
It could also be confusing as to which is the best way to provide functionality with so many different ways to do the same thing.
Ex 65 can be a little surprising if you have overloads of
debug_rep
forchar *
andconst char *
compiled together with the specializations: you can't get the specializations to be called to save your life.Of course the book says as much:
However, it's already a big book (so much for a "primer" 🥲), and it's easy to just skim over this important detail. It could also be confusing as to which is the best way to provide functionality with so many different ways to do the same thing.
I found a great link that goes a little further into this issue, which happens to answer ex 66 somewhat: http://www.gotw.ca/publications/mill17.htm
Hope this helps others who are not sure about all this specialization chaos.