#include #include using namespace std; template class Node { public: T value; Node* next; }; template void print_list( Node * head, ostream & out_str ) { if ( !head ) out_str << " " << endl; else { // Since head was passed by value, this code does not change // the value of the pointer passed to this function. while ( head ) { out_str << " " << head->value << endl; head = head->next; } } }