Logotyp

Programspråksteori, dt096g

Lokal inloggning

Lab assignment Meta programming c++

templates

Overview

The objective of this lab is to investigate the c++ templating mech-
anism and implement an algorithm solved at compile time.

Deliverables

A complete implementation in c++. A discussion
on the topic of templates and your solution. As well as the output
from the execution provided below.

Implementation

Choose from one of the following two tasks:

You can verify that your hanoi solution is a correct one by trying a
compile with a stack size of about 14-16 disks. This should take a
long time.

Hints

The templaing used in this lab will differ greatly from the more common type parametrization. You will be using numeric arguments as template parameters, and specialized templates for terminating recursion. You should also investigate inheritance in the context of
templates, e.g. you define a template T with parameter
(type T) and inherit from base type T, this will provide
a recursive inheritance tree.