Skip to content

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

@funct7

Description

@funct7

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions