aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--list.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/list.cpp b/list.cpp
index 937e7a7..009ed9a 100644
--- a/list.cpp
+++ b/list.cpp
@@ -4,6 +4,7 @@
*/
#include <cstdio>
+#include <iostream>
#include <cstdlib>
template <typename T>
@@ -34,6 +35,15 @@ List<T> *append(List<T> *lst, T value)
return lst;
}
+template <typename T>
+std::ostream& operator<<(std::ostream& ostream, const List<T> *lst)
+{
+ if (lst == NULL)
+ return ostream;
+ ostream << "|" << lst->value << lst->next;
+ return ostream;
+}
+
int main(void)
{
return 0;