21 lines
340 B
C++
21 lines
340 B
C++
#pragma once
|
|
|
|
template <class T>
|
|
struct List {
|
|
struct Container {
|
|
T* t;
|
|
Container* next;
|
|
Container(T* t) : t(t) {}
|
|
};
|
|
|
|
Container* first;
|
|
Container* last;
|
|
|
|
void add(T* t) {
|
|
Container* c = new Container{t};
|
|
first == nullptr ? first = c : last->next = c;
|
|
last = c;
|
|
}
|
|
|
|
};
|