Compare commits

..

No commits in common. "23e7860e43ec61f115054611d293435e1615993e" and "05d637acb5699444bd96490016ec374a267f8496" have entirely different histories.

4 changed files with 15 additions and 12 deletions

View File

@ -8,17 +8,17 @@ namespace Generic {
public:
DirectedNode(T value, std::shared_ptr<NodeType> left = nullptr, std::shared_ptr<NodeType> right = nullptr);
~DirectedNode();
T value;
std::shared_ptr<NodeType> left;
std::shared_ptr<NodeType> right;
protected:
T mValue;
std::shared_ptr<NodeType> mLeft;
std::shared_ptr<NodeType> mRight;
};
template <typename T, typename NodeType>
DirectedNode<T, NodeType>::DirectedNode(T value, std::shared_ptr<NodeType> left, std::shared_ptr<NodeType> right) {
this->value = value;
this->left = left;
this->right = right;
this->mValue = value;
this->mLeft = left;
this->mRight = right;
}
template <typename T, typename NodeType>

View File

@ -8,14 +8,15 @@ namespace Generic {
public:
UndirectedNode(T value, std::shared_ptr<NodeType> next = nullptr);
~UndirectedNode();
T value;
std::shared_ptr<NodeType> next;
protected:
T mValue;
std::shared_ptr<NodeType> mNext;
};
template <typename T, typename NodeType>
UndirectedNode<T, NodeType>::UndirectedNode(T value, std::shared_ptr<NodeType> next) {
this->value = value;
this->next = next;
this->mValue = value;
this->mNext = next;
}
template <typename T, typename NodeType>

View File

@ -49,7 +49,7 @@ namespace Datastructures {
}
//Add new node and set to tail.
(*mTail).next = std::make_shared<Nodes::LinkedListNode<T>>(value);
mTail = (*mTail).next;
(*mTail).mNext = std::make_shared<Nodes::LinkedListNode<T>>(value);
mTail = (*mTail).mNext;
}
}

View File

@ -9,6 +9,8 @@ namespace Datastructures {
public:
//Inherit Constructor and destructor from generic Undirectetd Node
using Generic::UndirectedNode<T, LinkedListNode<T>>::UndirectedNode;
template <typename T>
friend class LinkedList;
private:
};
}