A homework assignment calls for the overloading of the consignment operator for a Heap class that is used to store pointers to queues at every node in an attempt to emulate a Emergency room priority queue.
So far here is the code I've come up with:
template <typename T>
Heap<T>& Heap<T>::operator=(const Heap<T> & rhs)
{
//check for self-assignment
if(this != &rhs)
{
//delete memory
for(int i = 0; i < MAX_HEAP; i++)
{
//delete queue at position i, set pointer to NULL
delete items[i];
items[i] = NULL;
}//end for
delete * items;
//create new memory to hold copy of rhs
//error occurs here
items = new queue<T> *[MAX_HEAP] ;
for(int i = 0; i < MAX_HEAP; i++)
items[i] = rhs.items[i];
//assigns new stuff to this heap
size = rhs.size;
nodes = rhs.nodes;
}//end if
return *this;
}//end =
items is declared in the header file as such:
queue<T>* items[MAX_HEAP];
and is an instance of the standard library queue.
I am not quite sure if I am using the proper syntax for creating a new dynamic array of queue pointers.
I am getting an error that says:
error C2440: '=' : cannot convert from 'std::queue<_Ty> **' to 'std::queue<_Ty> *[50]'
Any ideas as to what might cause it and how I can solve it?