list - /*/ /* FILE: list.H */ /*/ #ifndef LIST_H #define...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/************************************************************/ /* FILE: list.H */ /************************************************************/ #ifndef LIST_H #define LIST_H #include <iostream.h> /********************************************************************** * FIGarray: * * Templated array-based list. It resizes itself as necessary. * Constructor lets you specify the expected size, which is * useful for large arrays (as it improves efficiency in that * case). **********************************************************************/ template <class Type> class FIGarray { protected: Type* _array; // pointer to the data int _num; // number of elements in the array int _max; // max elements for currently allocated array // realloc() is called automatically as necessary // when the array runs out of room. twice as much // memory is allocated as previously, and old data // is copied to new memory. old memory is deleted: void realloc() { Type* tmp; _max *= 2; if((tmp = new Type [_max]) == 0)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 06/12/2011.

Page1 / 3

list - /*/ /* FILE: list.H */ /*/ #ifndef LIST_H #define...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online