CS210 Lab: Templates Postlab


Postlab Exercise:

In the lab exercise you learned about making your own templated functions and classes. In this postlab you will begin to learn how templates help you be a more efficient C++ programmer by using the Standard Template Library - the STL. There are two parts to this postlab exercise. In the first part you will be introduced to some templated functions, in the second you will learn to use vectors - a powerful templated array.

Part 1:

Discussion:

In the lab you saw two examples of custom templated functions - maxi and swapper. You might think that max and swap would be better names. You're right!

Modern C++ comes with several templated functions in the utility and algorithm headers.



Part 2:

Discussion:

function prototype:


Write code to:

For Answers, click here
Back to Template Lab click here

CS Dept Home Page
CS Dept Class Files
CS210 Class Files

Copyright: Department of Computer Science, University of Regina.