mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 10:32:29 +00:00
feat(list): add list templates
This commit is contained in:
parent
7713223e60
commit
ced42bbfed
8 changed files with 434 additions and 0 deletions
23
storm/list/TSExplicitList.hpp
Normal file
23
storm/list/TSExplicitList.hpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef STORM_LIST_TS_EXPLICIT_LIST_HPP
|
||||
#define STORM_LIST_TS_EXPLICIT_LIST_HPP
|
||||
|
||||
#include "list/TSGetExplicitLink.hpp"
|
||||
#include "list/TSList.hpp"
|
||||
#include <cstdlib>
|
||||
|
||||
#define STORM_EXPLICIT_LIST(T, link) TSExplicitList<T, offsetof(T, link)>
|
||||
|
||||
template <class T, size_t offset>
|
||||
class TSExplicitList : public TSList<T, TSGetExplicitLink<T>> {
|
||||
public:
|
||||
// Member functions
|
||||
TSExplicitList();
|
||||
};
|
||||
|
||||
template <class T, size_t offset>
|
||||
TSExplicitList<T, offset>::TSExplicitList()
|
||||
: TSList<T, TSGetExplicitLink<T>>() {
|
||||
this->SetLinkOffset(offset);
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue