Ch 9. Templates and Containers

5/31/00


Click here to start


Table of Contents

Ch 9. Templates and Containers

Introduction

Template Classes

Template Classes

Template Classes

Template Classes

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

The Standard Template Library

Containers

Table 9.1 Comparison of Vector Methods

Containers

Deque

Set

Map

Stack and Queue

Priority Queue

Iterators

Example of Iterators

Iterators

Iterators

Iterators

Iterators

template <class iterator, class T>

Iterator

Generic Algorithms

Function Objects

Function Objects

LargerThan(12) // creates an instance of LargerThan

Author: Seung Sean Yoo

Email: budd@cs.orst.edu

Home Page: http://www.cs.orst.edu/~budd