Ch 9. Templates and Containers
Introduction
Template Classes
template <int s> class bitSet { public: set (int index) { ... } test (int index) { ... } void operator = (bitSet<s> & right); protected: // assume 16 bits per word int data [ (s + 15)/ 16 ];
bitSetញ> a;
Template Methods
Template Function
Template function types will be inferred from the argument values and need not be specified by the programmer.
Template Functions
The Standard Template Library
Containers
Table 9.1 Comparison of Vector Methods
Deque
Set
Map
Stack and Queue
Priority Queue
Iterators
Example of Iterators
template <class iterator, class T>
Iterator
Generic Algorithms
Function Objects
LargerThan(12) // creates an instance of LargerThan
Email: budd@cs.orst.edu
Home Page: http://www.cs.orst.edu/~budd