I changed my code and it works perfectly except for an error on exit. I have localized it to be in the destructer, but the error goes away if i add the node differently. e.g
in the destructor i just loop and use free(node), but it will generate a Debug Error, Damage after block etc. if i use the malloc version.
/* if i do it like this, there is no error in the free function in the class destructer */
if(!(nodeToAdd = new _node<_data>()))
/* however if i do it like this, it will generate an error in the class destructers free function */
if((nodeToAdd = (_node<_data>*)malloc(sizeofdata))==NULL)
Just wondering, have you got any thought on that?