Chapter 5. Flavors of Genericity, Part 1: Covering the Basis [sic]

Difficulty: 4

To get our feet wet before delving into Item 6, consider this simple example of flexible generic code in C++. The code examples in this Item and the next are taken from Exceptional C++ [Sutter00, page 42].

Solution

  1. “C++ templates provide compile-time polymorphism.” Explain.

When we think of polymorphism in an object-oriented world, we think of ...

Get Exceptional C++ Style 40 New Engineering Puzzles, Programming Problems, and Solutions 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.