Hi,
I have a problem with a class and making copy's of pointers within that class.
template <class IT, class T>
T* Dictionary<IT,T>::get(IT index)
{
int returnIndex;
if((returnIndex = lIndex.indexOf(index)) != -1)
return lData[returnIndex];
return NULL;
}
template <class T>
int List<T>::indexOf(T object)
{
for(int i = 0; i < (int)data.size(); i++)
{
if(data.at(i) == object)
return i;
}
return -1;
}
class Refrance
{
char * sName;
...
}
sName in indexOf() and get() both point to the same memory location, so if I call "delete[] sName;" in the destructor I get a crash on return NULL in the dictionary...
Do you guys have any idea no how to fix this small isue?