What I Learned from Scott Meyers' Effective C++, Part 7
Chapter 7: Templates and Generic Programming
In my previous chapter, we discussed Inheritance and Object-Oriented Design. In this chapter, we'll talk about what I learned in chapter 7 of the book, items 41 to 48.
Item 41: Understand implicit interfaces and compile-time polymorphism
Classes and templates both support polymorphism concepts albeit with certain differences. Classes use explicit interfaces and polymorphism is achieved with virtual functions at runtime. Template parameters however use implicit interfaces and polymorphism is achieved through template instantiation.
Item 42: Understand the two meanings of typename
When declaring template parameters, class and typename are interchangeable. However, typename is required to identify nested dependent type names.
Item 43: Know how to access names in templatized base classes
It is possible to derive from a base class within templates as well. However, it is important to use this keyword, an explicit base class qualification or "using declarations" to access base classes.
The following items require more understanding of template programming than I have and the titles themselves are self-explanatory so I will only leave the titles for the rest.
Item 44: Factor parameter-independent code out of templates
Item 45: Use member function templates to accept all compatible types.
Item 46: Define non-member functions inside templates when type conversions are desired
Item 47: Use traits classes for information about types
Item 48: Be aware of template metaprogramming
That's it for this chapter, next article will be about Chapters 8 and 9, Customizing new and delete as well as the final chapter miscellany.