PrintList to pass the list by value, not by reference.
void PrintList(ListT list);
ItemT x;
...
ItemT y{x};
ItemT z(x);
ListT(const ListT & src); ListT(ListT src);
ListT list; ListT b; ... b = list;
listBomb.cpp:26:10: warning: implicitly-declared 'constexpr ListT& ListT::operator=(const ListT&)' is deprecated [-Wdeprecated-copy]
26 | b = list;
| ^~~~
In file included from listBomb.cpp:2:
ListT.h:8:7: note: because 'ListT' has user-provided 'ListT::ListT(const ListT&)'
8 | ListT(const ListT & src);
| ^~~~~
a = b actually returns the value of a, once b has been copied.
this
this pointer to solve the next two problems.
a = a
ListT & operator =(const ListT & src);
if (this != &src)
return *this;