Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ch 16 - some further reading for ex65 and 66 #825

Open
funct7 opened this issue Jan 15, 2023 · 0 comments
Open

Ch 16 - some further reading for ex65 and 66 #825

funct7 opened this issue Jan 15, 2023 · 0 comments

Comments

@funct7
Copy link

funct7 commented Jan 15, 2023

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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant