1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-08-27 13:04:41 +03:00
Files
esp8266/libraries/ESP8266WiFi/src/include/slist.h
2015-06-25 00:13:55 +03:00

39 lines
599 B
C++

#ifndef SLIST_H
#define SLIST_H
template<typename T>
class SList {
public:
SList() : _next(0) { }
protected:
static void _add(T* self) {
T* tmp = _s_first;
_s_first = self;
self->_next = tmp;
}
static void _remove(T* self) {
if (_s_first == self) {
_s_first = self->_next;
self->_next = 0;
return;
}
for (T* prev = _s_first; prev->_next; prev = prev->_next) {
if (prev->_next == self) {
prev->_next = self->_next;
self->_next = 0;
return;
}
}
}
static T* _s_first;
T* _next;
};
#endif //SLIST_H