/
thomas-king
/
IdentifierParser
Обзор
Документация
Войти
/
thomas-king
/
IdentifierParser
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
include/lib/ListNode.h
45 строк
698 B
AceRodstin
Replace Node with ListNode.
30 дек 2022, 17:23
30 дек 2022, 17:23
f8a3286
Код
Авторство
О чём код?
// // ListNode.h // Libraries // // Created by Ace Rodstin on 30 Dec 2022. // #ifndef LISTNODE_HEADER_FILE #define LISTNODE_HEADER_FILE #include <memory> using namespace std; template<class T> struct ListNode { unique_ptr<ListNode> next; T value; ListNode(unique_ptr<ListNode> next, T value) { this->next = move(next); this->value = value; }; ListNode& end() { if (next) { return next->end(); } else { return *this; } } template<class C> void for_each(C closure) { closure(this->value); if (next != nullptr) { next->for_each(closure); } } }; #endif