Download this episode
In Part 3, STL digs into Overload Resolution. A function template can overload non-template functions of the same name. In this scenario, function calls are resolved by first using template argument deduction to instantiate the function template with a unique specialization (STL taught us all about TAD in Part 2). If template argument deduction fails, the other function overloads are considered to resolve the call. These other overloads, also known as the candidate set, include nontemplate functions and other instantiated function templates. If template argument deduction succeeds, then the generated function is compared with the other functions to determine the best match, following the rules for overload resolution. [source]
As STL says: "I walk through why foo(const T&) beats foo(const T *), when given int *. The reason is surprisingly subtle."
Available formats for this video:
Actual format may change based on video formats available and browser capability.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.