'current' is always dereferenced in 'list::showlist' even if it's invalid (currentSize == 0). You might want something along the lines of:
void list::showlist()
{
if (currentSize)
{
cout<<"\n\n********************************************************"<<endl;
cout<<"size:\t"<<currentSize<<"\n"<<endl;
cout<<"current val:\t"<<current->nodeData<<"\n"<<endl;
cout<<"current->next:\t"<<current->next<<"\n"<<endl;
int i = 1;
for(node * temp = head; temp != 0; temp = temp->next)
{
//display that info
cout<<"element "<<i<<"\t"<<temp->nodeData<<endl;
i++;
}
cout<<"\n\n********************************************************@"<<endl;
}
else
{
// Don't dereference invalid pointers.
}
} There may be other things wrong too, that just stands out. Aslo:
template<typename Ty>
void function(const Ty& val)
{
}
// ...
struct test {};
test tester;
function(tester);