Moved all function definitions into header files as required for templated classes/functions
This commit is contained in:
parent
5913fb8084
commit
96d5eb8071
@ -1,13 +0,0 @@
|
|||||||
#include "directednode.h"
|
|
||||||
|
|
||||||
namespace Generic {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, typename NodeType>
|
|
||||||
DirectedNode<T, NodeType>::~DirectedNode() {}
|
|
||||||
}
|
|
@ -14,4 +14,14 @@ namespace Generic {
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename NodeType>
|
||||||
|
DirectedNode<T, NodeType>::~DirectedNode() {}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
#include "undirectednode.h"
|
|
||||||
|
|
||||||
namespace Generic {
|
|
||||||
template <typename T, typename NodeType>
|
|
||||||
UndirectedNode<T, NodeType>::UndirectedNode(T value, std::shared_ptr<NodeType> left, std::shared_ptr<NodeType> right){
|
|
||||||
this->value = value;
|
|
||||||
this->next = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, typename NodeType>
|
|
||||||
UndirectedNode<T, NodeType>::~UndirectedNode() {}
|
|
||||||
}
|
|
@ -13,4 +13,13 @@ namespace Generic {
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T, typename NodeType>
|
||||||
|
UndirectedNode<T, NodeType>::UndirectedNode(T value, std::shared_ptr<NodeType> left, std::shared_ptr<NodeType> right) {
|
||||||
|
this->value = value;
|
||||||
|
this->next = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename NodeType>
|
||||||
|
UndirectedNode<T, NodeType>::~UndirectedNode() {}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
#include "linkedlist.h"
|
|
||||||
#include "linkedlistnode.h"
|
|
||||||
|
|
||||||
namespace Datastructures {
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "linkedlistnode.h"
|
||||||
|
|
||||||
namespace Datastructures {
|
namespace Datastructures {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class LinkedList
|
class LinkedList
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
#include "linkedlistnode.h"
|
|
||||||
|
|
||||||
namespace Datastructures {
|
|
||||||
namespace Nodes {
|
|
||||||
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) {
|
|
||||||
return std::make_shared<LinkedListNode<T>>(value, next);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,5 +15,17 @@ namespace Datastructures {
|
|||||||
private:
|
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) {
|
||||||
|
return std::make_shared<LinkedListNode<T>>(value, next);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user