/* list.cpp * Date: 2021-11-20 * Author: Aryadev Chavali */ #include #include #include template struct List { T value; struct List *next; }; template List *append(List *lst, T value) { List *node; if (lst == NULL) { node = new List; node->value = value; node->next = NULL; return node; } for (node = lst; node->next != NULL; node = node->next) continue; node->next = new List; node->next->value = value; node->next->next = NULL; return lst; } template std::ostream& operator<<(std::ostream& ostream, const List *lst) { if (lst == NULL) return ostream; ostream << "|" << lst->value << lst->next; return ostream; } int main(void) { return 0; }