mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-02-04 00:49:08 +00:00
feat(list): implement copy constructor
This commit is contained in:
parent
48a2315122
commit
f46c0c2c4c
2 changed files with 59 additions and 2 deletions
|
|
@ -19,14 +19,17 @@ template <class T, class TGetLink>
|
|||
class TSList {
|
||||
public:
|
||||
// Member variables
|
||||
ptrdiff_t m_linkoffset = 0;
|
||||
ptrdiff_t m_linkoffset;
|
||||
TSLink<T> m_terminator;
|
||||
|
||||
// Member functions
|
||||
TSList();
|
||||
TSList(const TSList& source);
|
||||
~TSList();
|
||||
void ChangeLinkOffset(ptrdiff_t linkoffset);
|
||||
void Clear();
|
||||
void Constructor();
|
||||
void CopyConstructor(const TSList& source);
|
||||
T* DeleteNode(T* ptr);
|
||||
T* Head();
|
||||
void InitializeTerminator();
|
||||
|
|
@ -49,7 +52,12 @@ class TSList {
|
|||
|
||||
template <class T, class TGetLink>
|
||||
TSList<T, TGetLink>::TSList() {
|
||||
this->InitializeTerminator();
|
||||
this->Constructor();
|
||||
}
|
||||
|
||||
template <class T, class TGetLink>
|
||||
TSList<T, TGetLink>::TSList(const TSList& source) {
|
||||
this->CopyConstructor(source);
|
||||
}
|
||||
|
||||
template <class T, class TGetLink>
|
||||
|
|
@ -74,6 +82,16 @@ void TSList<T, TGetLink>::Clear() {
|
|||
}
|
||||
}
|
||||
|
||||
template <class T, class TGetLink>
|
||||
void TSList<T, TGetLink>::Constructor() {
|
||||
this->SetLinkOffset(0);
|
||||
}
|
||||
|
||||
template <class T, class TGetLink>
|
||||
void TSList<T, TGetLink>::CopyConstructor(const TSList& source) {
|
||||
this->SetLinkOffset(source.m_linkoffset);
|
||||
}
|
||||
|
||||
template <class T, class TGetLink>
|
||||
T* TSList<T, TGetLink>::DeleteNode(T* ptr) {
|
||||
T* next = this->Next(ptr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue