11.7.  Review Questions

[ fromfile: generics-questions.xml id: generics-questions ]

  1. Explain an important difference between a template parameter and a function parameter.

  2. What does it mean to instantiate a template function? Describe one way to do this.

  3. Normally, you need to place template definitions in header files. Why is this?

  4. Some compilers support export. What is it for?

  5. Qt's container classes are used to collect value types. What kinds of things are not appropriate to store by value in a value collection?

  6. Which containers provide a mapping from key to value? List and describe at least two, and tell how they are different from one another.

  7. What does it mean for a container to "manage" its heap objects? How can a container of pointers to heap objects become a "managed container"?

  8. Give at least three examples of Qt classes that implement the Flyweight pattern.

  9. When defining a class template, how should the code be distributed between the header (.h) file and the implementation (.cpp) file? Explain your answer.