as-Node
This commit is contained in:
22
LinearList/as-List/chainNode.h
Normal file
22
LinearList/as-List/chainNode.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
template <typename T>
|
||||
class chainNode {
|
||||
public:
|
||||
T element;
|
||||
chainNode<T>* next;
|
||||
//C11 can write like : std::unique_ptr<chainNode<T>> next;
|
||||
|
||||
public:
|
||||
chainNode();
|
||||
chainNode(const T& x, chainNode<T>* next = nullptr);
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
chainNode<T>::chainNode() {
|
||||
this->next = nullptr;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
chainNode<T>::chainNode(const T& x, chainNode<T>* next) : element(x), next(next) {
|
||||
}
|
Reference in New Issue
Block a user