Open m2mer opened 6 years ago
I'm confused. If there is no data, a new object is malloc'd and returned? or what is going on here...
If there is no data, a new object of type T is default-constructed and returned. For simple types like int\char it won't allocate memory, just put zero value into some register and return.
template
T LinkedList::get(int index){
ListNode *tmp = getNode(index);
} no matter success or not, an instance of T is returned, so how to judge?