Compare commits
2 Commits
05d637acb5
...
23e7860e43
Author | SHA1 | Date | |
---|---|---|---|
23e7860e43 | |||
25091543a2 |
@ -8,17 +8,17 @@ namespace Generic {
|
|||||||
public:
|
public:
|
||||||
DirectedNode(T value, std::shared_ptr<NodeType> left = nullptr, std::shared_ptr<NodeType> right = nullptr);
|
DirectedNode(T value, std::shared_ptr<NodeType> left = nullptr, std::shared_ptr<NodeType> right = nullptr);
|
||||||
~DirectedNode();
|
~DirectedNode();
|
||||||
|
T value;
|
||||||
|
std::shared_ptr<NodeType> left;
|
||||||
|
std::shared_ptr<NodeType> right;
|
||||||
protected:
|
protected:
|
||||||
T mValue;
|
|
||||||
std::shared_ptr<NodeType> mLeft;
|
|
||||||
std::shared_ptr<NodeType> mRight;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, typename NodeType>
|
template <typename T, typename NodeType>
|
||||||
DirectedNode<T, NodeType>::DirectedNode(T value, std::shared_ptr<NodeType> left, std::shared_ptr<NodeType> right) {
|
DirectedNode<T, NodeType>::DirectedNode(T value, std::shared_ptr<NodeType> left, std::shared_ptr<NodeType> right) {
|
||||||
this->mValue = value;
|
this->value = value;
|
||||||
this->mLeft = left;
|
this->left = left;
|
||||||
this->mRight = right;
|
this->right = right;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename NodeType>
|
template <typename T, typename NodeType>
|
||||||
|
@ -8,15 +8,14 @@ namespace Generic {
|
|||||||
public:
|
public:
|
||||||
UndirectedNode(T value, std::shared_ptr<NodeType> next = nullptr);
|
UndirectedNode(T value, std::shared_ptr<NodeType> next = nullptr);
|
||||||
~UndirectedNode();
|
~UndirectedNode();
|
||||||
protected:
|
T value;
|
||||||
T mValue;
|
std::shared_ptr<NodeType> next;
|
||||||
std::shared_ptr<NodeType> mNext;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, typename NodeType>
|
template <typename T, typename NodeType>
|
||||||
UndirectedNode<T, NodeType>::UndirectedNode(T value, std::shared_ptr<NodeType> next) {
|
UndirectedNode<T, NodeType>::UndirectedNode(T value, std::shared_ptr<NodeType> next) {
|
||||||
this->mValue = value;
|
this->value = value;
|
||||||
this->mNext = next;
|
this->next = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename NodeType>
|
template <typename T, typename NodeType>
|
||||||
|
@ -49,7 +49,7 @@ namespace Datastructures {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Add new node and set to tail.
|
//Add new node and set to tail.
|
||||||
(*mTail).mNext = std::make_shared<Nodes::LinkedListNode<T>>(value);
|
(*mTail).next = std::make_shared<Nodes::LinkedListNode<T>>(value);
|
||||||
mTail = (*mTail).mNext;
|
mTail = (*mTail).next;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,8 +9,6 @@ namespace Datastructures {
|
|||||||
public:
|
public:
|
||||||
//Inherit Constructor and destructor from generic Undirectetd Node
|
//Inherit Constructor and destructor from generic Undirectetd Node
|
||||||
using Generic::UndirectedNode<T, LinkedListNode<T>>::UndirectedNode;
|
using Generic::UndirectedNode<T, LinkedListNode<T>>::UndirectedNode;
|
||||||
template <typename T>
|
|
||||||
friend class LinkedList;
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user