std::list<Tree<T>&>* children;
Standard containers can’t store reference types. From the rest of the code, it looks like this should store Tree<T>
objects. (If you wanted to refer to objects that live somewhere else, you’d have to store pointers rather than references; but this doesn’t seem to be the case here).
You also have a duplicate default argument on both the declaration and definition of printTree
, and a missing typename
where you declare std::list<Tree<T>>::iterator i
in printTree
; it’s possible that your compiler will accept these errors though.
4
solved Why this c++ code doesn’t compile? [closed]