Managing an array using typedef

For a programming project I need to have an array of an object (declared using typedef) with various functions for adding, removing, and iterating through it.

My class is called DrawList and in my DrawList.h file I have this line:
typedef MyRect value_type;

and then in the .cpp file I have these two functions:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
value_type DrawList::remove_last()
{
	assert (used != 0);
	used--;
	value_type temp = list[used];
	//list[used] = NULL;
	return temp;
}

DrawList::value_type DrawList::operator *()
{
	//if(current_index >= 0 && current_index < used)
	return list[current_index];
	//else
	//return NULL;
}


With the lines commented out the code compiles correctly, but if I try to set an element to NULL or use NULL as a value_type the compiler throws an error.
 
#include <stdexcept> 
1
2
   ...
   else throw std::out_of_range( "DrawList::operator *()" );

Hope this helps.
Topic archived. No new replies allowed.