9.5. Specializing Template Functions

Template functions affect overloading resolution (page 270). The compiler uses the following algorithm to resolve overloaded function calls.

  1. Look at all nontemplate functions first, and determine if there is a function whose signature exactly matches the function call's argument types.

  2. Look for a template function whose signature exactly matches the function call's argument types.

  3. Resolve the function call with nontemplate functions, using conversion rules (trivial conversions, promotions, standard conversions, and user-defined conversions).

Template function signatures must match function call arguments exactly in the second step. The compiler attempts conversions for arguments only in the third step. Compilation ...

Get Navigating C++ and Object-Oriented Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.