Algorithms as Patterns for Code

Steven J. Zeil

Old Dominion University, Dept. of Computer Science

Table of Contents

1. Same Pattern: Different Code
2. Generalizing the Element Type
3. Making Copies

Not everything in a typical library is a class. In recent years, programmers have paid increasing attention to the use of templates, which describe common patterns for similar classes and functions that differ only in a few names.

Templates come in two varieties

Class templates are patterns for similar classes. Function templates are patterns for similar functions.

In this lesson, we'll explore why the idea of a pattern for several different codes can be useful.

In the Forum:

(no threads at this time)