Updated Linked List to inherit generic constructors.
Not sure how the create method will integrate. Might integrate it into the linked list class so that it can just append it straight into the relevant node.
This commit is contained in:
@ -132,12 +132,6 @@
|
||||
<ClInclude Include="src\LinkedList\linkedlist.h" />
|
||||
<ClInclude Include="src\LinkedList\linkedlistnode.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Generic\directednode.cpp" />
|
||||
<ClCompile Include="src\Generic\undirectednode.cpp" />
|
||||
<ClCompile Include="src\LinkedList\linkedlist.cpp" />
|
||||
<ClCompile Include="src\LinkedList\linkedlistnode.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
@ -28,18 +28,4 @@
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Generic\directednode.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Generic\undirectednode.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LinkedList\linkedlist.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LinkedList\linkedlistnode.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -8,8 +8,9 @@ namespace Datastructures {
|
||||
public:
|
||||
LinkedList();
|
||||
~LinkedList();
|
||||
|
||||
private:
|
||||
|
||||
Nodes::LinkedListNode<T> mHead;
|
||||
Nodes::LinkedListNode<T> mTail;
|
||||
int mCount;
|
||||
};
|
||||
}
|
@ -7,21 +7,12 @@ namespace Datastructures {
|
||||
class LinkedListNode : public Generic::UndirectedNode<T, LinkedListNode<T>>
|
||||
{
|
||||
public:
|
||||
LinkedListNode(T value, std::shared_ptr<LinkedListNode<T>> next = nullptr);
|
||||
~LinkedListNode();
|
||||
|
||||
//Inherit Constructor from generic Undirectetd Node
|
||||
using Generic::UndirectedNode<T, LinkedListNode<T>>::UndirectedNode;
|
||||
std::shared_ptr<LinkedListNode<T>> create(T value, std::shared_ptr<LinkedListNode<T>> next = nullptr);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
LinkedListNode<T>::LinkedListNode(T value, std::shared_ptr<LinkedListNode<T>> next) {
|
||||
this->value = value;
|
||||
this->next = next;
|
||||
}
|
||||
|
||||
//Creates a new node, returning a smart pointer to a stack allocated object
|
||||
template <typename T>
|
||||
std::shared_ptr<LinkedListNode<T>> LinkedListNode<T>::create(T value, std::shared_ptr<LinkedListNode<T>> next) {
|
||||
|
Reference in New Issue
Block a user