Question: Q) Suppose that you convert a bag class into a new template class. Name one place where the word bag remains just bag instead of
Q) Suppose that you convert a bag class into a new template class. Name one place where the word bag remains just bag instead of changing to bag
Q) Complete the body of this template function. Check the precondition as much as possible, and don't cause a heap leak.
templatevoid list_head_remove(node - *& head_ptr) // Precondition: head_ptr is the head pointer of a linked list, // with at least one node. // Postcondition: The head node has been removed and returned to the heap; // head_ptr is now the head pointer of the new, shorter linked list.
Q) What is a major difference between the header file for a toolkit of template functions and the header file for a toolkit of ordinary functions?
A. The ordinary function toolkit header file must have a #include for the implementation file, but the template version does not have this #include.
B. The template function toolkit header file must have a #include for the implementation file, but the ordinary version does not have this #include.
C. The ordinary function toolkit header file must have a macro guard, but the template version does not have this macro guard.
D. The template function toolkit header file must have a macro guard, but the ordinary version does not have this macro guard.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
