(list)+simple output mechanism via C++ streams

cout has inbuilt support for multiple types, easier than using
printf.  Just have to ease the compiler into it
This commit is contained in:
2021-11-20 22:50:05 +00:00
parent fccfcd4a9f
commit fc6fc4032b

View File

@@ -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;