How to define a node template for a linked list? I also want to keep the pointer type as template parameter so that I can change it to unique_ptr or shared_ptr depends on what available.
template<typename T, typename NodePtr>
struct node{
T data;
NodePtr parent = nullptr;
};
The question is that how to initiate this class so that Nodeptr will be shared_ptr < Node <T ,what?> >
type?
Aucun commentaire:
Enregistrer un commentaire